Macro vb

Patanrisitas, necesito de tu ayuda, para generar una macro en excel de la siguiente manera:
En una hoja de excel ingreso datos, tales como nombre, fecha, numero de reporte, etc., lo que quisiera es que mediante una macro se salve dicha hoja, y a su vez me envíe ciertos datos a una nueva hoja de excel.
Lo importante seria que vaya en función del numero de reporte, es decir, que si el número de reporte fuera el 25, buscara en la nueva hoja la celda que tiene el numero 25, y ahí me importara los datos.
Así mismo quisiera que si el numero de reporte estuviera repetido, me marcara un mensaje de error, y no me dejara grabar hasta corregir el numero de reporte.
Espero haberme dado a entender, de antemano mil gracias

1 respuesta

Respuesta
1
Prueba con esta macro yu me avisas:
Sub Registrar()
Nvou = Range("numero")
Sheets("Registro").Select
Range("A3").Select
While ActiveCell <> Empty
ActiveCell.Offset(1, 0).Select
If ActiveCell = Nvou Then
Rpta = MsgBox("Este voucher ya a sido registrada. ¿Desea registrarla nuevamente?", vbYesNo)
If Rpta = vbYes Then GoTo Sigue
GoTo Sale
End If
Wend
Sigue:
Sheets("Voucher").Select
Range("AE1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Sheets("REGISTRO").Select
Range("A3").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("A3").Select
Sheets("VOUCHER").Select
ActiveWindow.LargeScroll ToRight:=-1
Range("K2:L2").Select
Selection.NumberFormat = """001""-0000"
Selection.HorizontalAlignment = xlCenter
MsgBox ("El voucher se ha registrado exitosamente")
Sale:
Sheets("voucher").Select
End Sub

"Me avisas cualquier cosa"

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas