Visual Basic en Excel
Publicado por javier (4 intervenciones) el 25/10/2016 18:05:49
he realizado esta codigo para grabar desde un un formulario en excel. pero solo lo hace cuando la hoja esta activa. si abro otro archivo excel, me sale Error que la hoja no existe. agradecere quien me pueda ayudar.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
If Len(Trim(Ruc)) = 11 And IsNumeric(Ruc) Then
'ActiveWorkbook.Sheets.Select
'Sheets("clientes").Select
Range("B2").Select
Do While ActiveCell <> Empty
If CStr(ActiveCell) = txtRuc Then
MsgBox "RUC ya esta registrado", vbCritical, "Alerta"
GoTo Termina
End If
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.FormulaR1C1 = txtRuc
ActiveCell.Offset(0, 1).Select
Valora esta pregunta


0