Hola
Efectivamente el listbox es de una columna, esta va en la columna "P" (N° Folio).
Los datos fijos van en las columnas: B,C,D,E,F,AH,AI,AK,AL,AM,AN,AO,AR,AU,AV
El resto de las columnas (A,G,AG,AH,AI,AK,AL,AM,AN,AO,AP,AQ,AR,AU,AV,AW) contienen fórmulas (BUSCARV) que me enlazan a otras hojas de donde sacan la información para completar la base.
este es el código que tengo para registrar los datos en la base, todo esto funciona bien, pero me falta registrar la info del listbox, y como explicaba ayer, que si son mas de 1 folio, ejemplo 5 folios, los datos fijos ingresados una sola vez me los duplique hacia abajo también 5 veces, es decir, la cantidad de folios ingresados en el listbox será la cantidad de veces que deberán repetirse los datos fijos hacia abajo en la planilla excel.
Gracias una vez mas.
<pre class="prettyprint" style="width: 943px; height: 263px;">Private Sub CmdRegistro_Click()
Dim fila As Long
Dim duplicados As Boolean
Dim I As Integer
'Obtener la fila disponible
fila = Hoja2.Application.WorksheetFunction.CountA(Hoja2.Range("B:B")) + 2
duplicados = False
'Validar si se han ingresado datos duplicados
For I = 1 To fila
If Hoja2.Cells(I, 2).Value = Ingreso.TextBox1.Value Then
If Hoja2.Cells(I, 6).Value = Ingreso.TextBox3.Value Then
If Hoja2.Cells(I, 4).Value = Ingreso.TextBox4.Value Then
' If Hoja2.Cells(I, 16).Value = ListBox1 Then
If Hoja2.Cells(I, 34).Value = Ingreso.TextBox9.Value Then
If Hoja2.Cells(I, 37).Value = Ingreso.TextBox11.Value Then
If Hoja2.Cells(I, 47).Value = Ingreso.TextBox13.Value Then
If Hoja2.Cells(I, 48).Value = Ingreso.TextBox14.Value Then
If Hoja2.Cells(I, 50).Value = Ingreso.TextBox16.Value Then
If Hoja2.Cells(I, 68).Value = Ingreso.TextBox22 Then
'Se encontraron datos duplicados
MsgBox "Datos duplicados en la fila " & I
duplicados = True
End If
End If
End If
End If
End If
End If
End If
End If
End If
' End If
Next I
If Not duplicados Then
'Insertar datos capturados
Hoja2.Cells(fila, 2).Value = Ingreso.TextBox1.Value
Hoja2.Cells(fila, 6).Value = Ingreso.TextBox3.Value
Hoja2.Cells(fila, 3).Value = dtpServicio
Hoja2.Cells(fila, 35).Value = DTPicker1
Hoja2.Cells(fila, 5).Value = DTPicker2
Hoja2.Cells(fila, 33).Value = DTPicker4
Hoja2.Cells(fila, 44).Value = DTPicker6
Hoja2.Cells(fila, 40).Value = ComboBox1
Hoja2.Cells(fila, 47).Value = ComboBox3
' Hoja2.Cells(fila, 16).Value = ListBox1.List
Hoja2.Cells(fila, 4).Value = Ingreso.TextBox4.Value
Hoja2.Cells(fila, 34).Value = Ingreso.TextBox9.Value
Hoja2.Cells(fila, 37).Value = Ingreso.TextBox11.Value
Hoja2.Cells(fila, 47).Value = Ingreso.TextBox13.Value
Hoja2.Cells(fila, 48).Value = Ingreso.TextBox14.Value
Hoja2.Cells(fila, 50).Value = Ingreso.TextBox16.Value
Hoja2.Cells(fila, 68).Value = Ingreso.TextBox22.Value
'Limpiar cajas de texto
Ingreso.TextBox1.Value = ""
Ingreso.TextBox3.Value = ""
Ingreso.TextBox4.Value = ""
Ingreso.TextBox9.Value = ""
Ingreso.TextBox11.Value = ""
Ingreso.TextBox13.Value = ""
Ingreso.TextBox14.Value = ""
Ingreso.TextBox16.Value = ""
Ingreso.TextBox22.Value = ""
Ingreso.TextBox22.Value = ""
Ingreso.ListBox1.Value = ""
'Notificar al usuario
MsgBox "Datos ingresados en la fila " & fila
End If
End Sub</pre>