Buen dia comunidad estoy realizando una aplicacion en la cual a traves de un userform
voy a a registrar ciertos productos e informacion y en estos momentos necesito realizar el boton
de busqueda el cual tomara de las celdas los datos y mostrarlas en unos labels y text box,
no se requiere extraer todos los registros que tiene si no el ultimo realizado.
Para ello probe con el siguiente codigo.
On Error GoTo ManejadorErrores
lb\_Date = Application.WorksheetFunction.Index(Sheets("CX50").Range("A:A"), Application.WorksheetFunction.Match(TB\_SN, Sheets("CX50").Range("E:E")))
CB\_Model = Application.WorksheetFunction.Index(Sheets("CX50").Range("B:B"), Application.WorksheetFunction.Match(TB\_SN, Sheets("CX50").Range("E:E")))
TB\_PNin = Application.WorksheetFunction.Index(Sheets("CX50").Range("C:C"), Application.WorksheetFunction.Match(TB\_SN, Sheets("CX50").Range("E:E")))
TB\_PNout = Application.WorksheetFunction.Index(Sheets("CX50").Range("D:D"), Application.WorksheetFunction.Match(TB\_SN, Sheets("CX50").Range("E:E")))
TB\_WO = Application.WorksheetFunction.Index(Sheets("CX50").Range("F:F"), Application.WorksheetFunction.Match(TB\_SN, Sheets("CX50").Range("E:E")))
TB\_Description = Application.WorksheetFunction.Index(Sheets("CX50").Range("G:G"), Application.WorksheetFunction.Match(TB\_SN, Sheets("CX50").Range("E:E")))
TB\_Comment = Application.WorksheetFunction.Index(Sheets("CX50").Range("H:H"), Application.WorksheetFunction.Match(TB\_SN, Sheets("CX50").Range("E:E")))
CB\_FM = Application.WorksheetFunction.Index(Sheets("CX50").Range("I:I"), Application.WorksheetFunction.Match(TB\_SN, Sheets("CX50").Range("E:E")))
TB\_FMS = Application.WorksheetFunction.Index(Sheets("CX50").Range("J:J"), Application.WorksheetFunction.Match(TB\_SN, Sheets("CX50").Range("E:E")))
CB\_From = Application.WorksheetFunction.Index(Sheets("CX50").Range("K:K"), Application.WorksheetFunction.Match(TB\_SN, Sheets("CX50").Range("E:E")))
CB\_Tech = Application.WorksheetFunction.Index(Sheets("CX50").Range("L:L"), Application.WorksheetFunction.Match(TB\_SN, Sheets("CX50").Range("E:E")))
Lb\_Shift = Application.WorksheetFunction.Index(Sheets("CX50").Range("M:M"), Application.WorksheetFunction.Match(TB\_SN, Sheets("CX50").Range("E:E")))
CB\_Cloud = Application.WorksheetFunction.Index(Sheets("CX50").Range("N:N"), Application.WorksheetFunction.Match(TB\_SN, Sheets("CX50").Range("E:E")))
CB\_Status = Application.WorksheetFunction.Index(Sheets("CX50").Range("O:O"), Application.WorksheetFunction.Match(TB\_SN, Sheets("CX50").Range("E:E")))
CB\_RPRby = Application.WorksheetFunction.Index(Sheets("CX50").Range("P:P"), Application.WorksheetFunction.Match(TB\_SN, Sheets("CX50").Range("E:E")))
TB\_SNsub = Application.WorksheetFunction.Index(Sheets("CX50").Range("Q:Q"), Application.WorksheetFunction.Match(TB\_SN, Sheets("CX50").Range("E:E")))
TB\_PNsub = Application.WorksheetFunction.Index(Sheets("CX50").Range("R:R"), Application.WorksheetFunction.Match(TB\_SN, Sheets("CX50").Range("E:E")))
Boton\_Guardar.Enabled = False
El problema de este codigo es que no me muestra el ultimo registro aunque si extrae los datos.
En la hoja de calculo que tengo implemente esta formula
=INDEX(A2:A5,MAX(IF(IFERROR(MATCH(F2:F5,H12,0),"")=1,ROW(F2:F5)))) y esta si me da el ultimo registro realizado. El problema es que tendria que pasarlo a vba
o usar una hoja de calculo alterna solo para esta funcion, la segunda opcion no se me hace viable esto debido a que mi documento se me haria mas grande y tendria que vincular las hojas a dicha pagina trato de que sea lo mas auutomatizado posible pero cuando trato de hacer esta misma funcion en vba por la palabra reservada if no me aparece y no la puedo tener, hay alguna sugerencia que me puedan dar. Como dije y reitero necesito que esta funcion solo extraiga el último dato registrado.