Excel - Error al grabar desde VIsual Basic en Excell

 
Vista:

Error al grabar desde VIsual Basic en Excell

Publicado por Javier (2 intervenciones) el 26/10/2016 17:46:32
He creado un formulario en Visual BAsic dentro de Excel Codigo Guardar el cual funciona cuando solo esta abierto el archivo. arroja error cuando abro otro archivo excel.
favor podrias indicarme cual es mi error. o falta algun codigo

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Dim i As Integer
Dim Ruc As String
Ruc = txtRuc.Text
 
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
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder