
aqui les dejo la macros esta en office 2007 ahi viene todo gracias.
http://download.yousendit.com/8B1ECB12008431AD
| |||
![]() hola, quisiera me pudieran ayudar o dar ideas de como realizar una funcion, lo que pasa esque ya "termine" la macros es una encuesta e inserta datos a hojas lo que pasa esqe al insertar datos inserta el primer dato en la celda A12 y este seria el primero y el segundo al insertarse dezplaza a este primer dato y el segundo dato se qeda como primero y asi sucesivamente ahora lo que me pidieron esque eso ya no suceda me pidieron que el primer dato siempre se qede en la celda A12 y al ingresar otro dato pues se vaya a la celda A13 y asi sucesivamente, mi problema es que pues batalle mucho para hacer el codigo que termine porqe soy nuevo en esto y quisiera saber si alguien me puede dar opciones o ideas de como realizar lo que me piden de antemano gracias saludos.. ![]() aqui les dejo la macros esta en office 2007 ahi viene todo gracias. http://download.yousendit.com/8B1ECB12008431AD |
| ||||
Re: Insertar Datos En Hoja Uno Abajo De Otro Cita: No puedo descargar tu archivo porque no tengo Office 2007, podrías guardar en formato de Office anterior para que otros no tengan el mismo problema.
Iniciado por chicharroni ![]() hola, quisiera me pudieran ayudar o dar ideas de como realizar una funcion, lo que pasa esque ya "termine" la macros es una encuesta e inserta datos a hojas lo que pasa esqe al insertar datos inserta el primer dato en la celda A12 y este seria el primero y el segundo al insertarse dezplaza a este primer dato y el segundo dato se qeda como primero y asi sucesivamente ahora lo que me pidieron esque eso ya no suceda me pidieron que el primer dato siempre se qede en la celda A12 y al ingresar otro dato pues se vaya a la celda A13 y asi sucesivamente, mi problema es que pues batalle mucho para hacer el codigo que termine porqe soy nuevo en esto y quisiera saber si alguien me puede dar opciones o ideas de como realizar lo que me piden de antemano gracias saludos.. ![]() aqui les dejo la macros esta en office 2007 ahi viene todo gracias. http://download.yousendit.com/8B1ECB12008431AD Podrías simplemente usar Range:
Código:
y simplemente vas cambiando el índice... ThisWorkBook.WorkSheets(1).Range("A12") = "Value"
__________________ Por favor, antes de preguntar, revisa la Guía para realizar preguntas. |
| ||||
![]() Lo que modifiqué fue esto:
Código:
Así en vez de seleccionar la celda 12, seleccionamos la primera celda vacía que encontramos en Pregunta1... Private Function FindEmptyCell(Init As Byte) As String Dim Count As Integer Do If Worksheets("Pregunta1").Range("a" & CStr(Init + Count)) = "" Then FindEmptyCell = CStr(Init + Count) Exit Function End If Count = Count + 1 Loop End Function Private Sub CommandButton1_Click() Rem If TextBox4 <> Empty Then Dim vCell As String vCell = FindEmptyCell(12) Worksheets("Pregunta3").Activate Range("c" & vCell).Select Selection.EntireRow.Insert If i = 1 Then Worksheets("Pregunta3").Range("c" & vCell).Select ActiveCell.FormulaR1C1 = i Else Worksheets("Pregunta3").Range("c" & vCell).Select ActiveCell.FormulaR1C1 = 0 End If If j = 1 Then Worksheets("Pregunta3").Range("d" & vCell).Select ActiveCell.FormulaR1C1 = j Else Worksheets("Pregunta3").Range("d" & vCell).Select ActiveCell.FormulaR1C1 = 0 End If If k = 1 Then Worksheets("Pregunta3").Range("e" & vCell).Select ActiveCell.FormulaR1C1 = k Else Worksheets("Pregunta3").Range("e" & vCell).Select ActiveCell.FormulaR1C1 = 0 End If If l = 1 Then Worksheets("Pregunta3").Range("f" & vCell).Select ActiveCell.FormulaR1C1 = l Else Worksheets("Pregunta3").Range("f" & vCell).Select ActiveCell.FormulaR1C1 = 0 End If Worksheets("Pregunta3").Range("a" & vCell).Value = TextBox1 Worksheets("Pregunta3").Range("b" & vCell).Value = TextBox4 Worksheets("Pregunta2").Activate Range("c" & vCell).Select Selection.EntireRow.Insert If e = 1 Then Worksheets("Pregunta2").Range("c" & vCell).Select ActiveCell.FormulaR1C1 = e Else Worksheets("Pregunta2").Range("c" & vCell).Select ActiveCell.FormulaR1C1 = 0 End If If f = 1 Then Worksheets("Pregunta2").Range("d" & vCell).Select ActiveCell.FormulaR1C1 = f Else Worksheets("Pregunta2").Range("d" & vCell).Select ActiveCell.FormulaR1C1 = 0 End If If g = 1 Then Worksheets("Pregunta2").Range("e" & vCell).Select ActiveCell.FormulaR1C1 = g Else Worksheets("Pregunta2").Range("e" & vCell).Select ActiveCell.FormulaR1C1 = 0 End If If h = 1 Then Worksheets("Pregunta2").Range("f" & vCell).Select ActiveCell.FormulaR1C1 = h Else Worksheets("Pregunta2").Range("f" & vCell).Select ActiveCell.FormulaR1C1 = 0 End If Worksheets("Pregunta2").Range("a" & vCell).Value = TextBox1 Worksheets("Pregunta2").Range("b" & vCell).Value = TextBox4 Worksheets("Pregunta1").Activate Range("c" & vCell).Select Selection.EntireRow.Insert If a = 1 Then Worksheets("Pregunta1").Range("c" & vCell).Select ActiveCell.FormulaR1C1 = a Else Worksheets("Pregunta1").Range("c" & vCell).Select ActiveCell.FormulaR1C1 = 0 End If If b = 1 Then Worksheets("Pregunta1").Range("d" & vCell).Select ActiveCell.FormulaR1C1 = b Else Worksheets("Pregunta1").Range("d" & vCell).Select ActiveCell.FormulaR1C1 = 0 End If If c = 1 Then Worksheets("Pregunta1").Range("e" & vCell).Select ActiveCell.FormulaR1C1 = c Else Worksheets("Pregunta1").Range("e" & vCell).Select ActiveCell.FormulaR1C1 = 0 End If If d = 1 Then Worksheets("Pregunta1").Range("f" & vCell).Select ActiveCell.FormulaR1C1 = d Else Worksheets("Pregunta1").Range("f" & vCell).Select ActiveCell.FormulaR1C1 = 0 End If Worksheets("Pregunta1").Range("a" & vCell).Value = TextBox1 Worksheets("Pregunta1").Range("b" & vCell).Value = TextBox4 Worksheets("calificacion").Activate Range("c" & vCell).Select Selection.EntireRow.Insert Worksheets("Calificacion").Range("b" & vCell).Value = TextBox4 Worksheets("Calificacion").Range("a" & vCell).Value = TextBox1 Worksheets("Calificacion").Range("c" & vCell).Value = ComboBox1.Value Worksheets("Observaciones").Activate Range("c" & vCell).Select Selection.EntireRow.Insert Worksheets("Observaciones").Range("b" & vCell).Value = TextBox4 Worksheets("Observaciones").Range("a" & vCell).Value = TextBox1 Worksheets("Observaciones").Range("c" & vCell).Value = TextBox3 Rem Empty Limpia Los Textbox TextBox4 = Empty TextBox3 = Empty ComboBox1 = 10 Rem Textbox1SetFocus Envia el cursor al Textbox1 para volver a capturar los datos TextBox1.SetFocus Rem Else Rem MsgBox "Debe escribir su nombre" Rem TextBox4.SetFocus Rem End If End Sub
__________________ Por favor, antes de preguntar, revisa la Guía para realizar preguntas. |