Ingresar datos en hoja de excel

25/04/2008 - 04:01 por Bennet | Informe spam
Muy buenas a todos: En el Libro Captura1 utilizo un UserForm para ingresar
los datos al libro con el siguiente còdigo en un botòn de comando:
Dim CeldaInicial As Variant
Dim col As Integer
Dim fila As Integer
CeldaInicial = "A7"
Set CeldaInicial = Range(CeldaInicial)
col = CeldaInicial.Column
'Busca cuál es la última fila
If CeldaInicial.Offset(1, 0).Value = "" Then
fila = 8
Else
fila = CeldaInicial.End(xlDown).Row + 1
End If
'Comienza a copiar los valores del UserForm a la hoja del libro Captura1
Cells(fila, col) = " "
Cells(fila, col + 1).Value = TextBox29.Value
Cells(fila, col + 2).Value = TextBox30.Value

Set CeldaInicial = Nothing
End if

Esto funciona perfectamente, mi pregunta es como puedo hacer para que
ingrese los datos simultàneamente al Libro Captura1 y al Libro Resultados.

Mil gracias
S@lu2...
 

Leer las respuestas

#1 Héctor Miguel
25/04/2008 - 14:48 | Informe spam
hola, !

... En el Libro Captura1 utilizo un UserForm para ingresar los datos al libro (...)
Esto funciona perfectamente, mi pregunta es como puedo hacer para
que ingrese los datos simultaneamente al Libro Captura1 y al Libro Resultados...



(logicamente) primero deberias encontrar tambien la ultima fila del otro libro (EN SU HOJA correspondiente)

op1: incluir instrucciones (dobles) para el copiado en ambos libros (y abierto tambien "el otro") p.e.
Cells(fila, col) = " "
Workbooks("resultados").Worksheets("hoja X").Cells(fila2, col) = " "
Cells(fila, col + 1).Value = TextBox29.Value
Workbooks("resultados").Worksheets("hoja X").Cells(fila2, col + 1).Value = TextBox29.Value
Cells(fila, col + 1).Value = TextBox29.Value
Workbooks("resultados").Worksheets("hoja X").Cells(fila2, col + 1).Value = TextBox29.Value

op2: copiar los mismos datos "actualizados" en la sesion... de tu libro "captura" a tu libro "resultados"

si cualquier duda (o informacion adicional)... comentas ?
saludos,
hector.

__ el codigo expuesto __
Dim CeldaInicial As Variant
Dim col As Integer
Dim fila As Integer
CeldaInicial = "A7"
Set CeldaInicial = Range(CeldaInicial)
col = CeldaInicial.Column
'Busca cual es la ultima fila
If CeldaInicial.Offset(1, 0).Value = "" Then
fila = 8
Else
fila = CeldaInicial.End(xlDown).Row + 1
End If
'Comienza a copiar los valores del UserForm a la hoja del libro Captura1
Cells(fila, col) = " "
Cells(fila, col + 1).Value = TextBox29.Value
Cells(fila, col + 2).Value = TextBox30.Value
Set CeldaInicial = Nothing
End if

Preguntas similares