Hola, estoy haciendo un registro de inventario en excel, pero cuando habró el formulario y lo lleno todo los campos al darle al boton guardar me lanza este error "Error definido por la aplicación o definido por el objeto" y no se que tengo mal, cuando le doy a depurar se para sobre la linea que dice
If Cells(j, i) = " " Then
Aqui esta mi codigo
Private Sub guardar_Click()
Dim i, j As Integer
For i = 1 To 5
For j = 0 To 1
If Cells(j, i) = " " Then
Cells(j, i) = title.Text
Cells(j, i + 1) = content.Text
Cells(j, i + 1) = dat.Text
Cells(j, i + 1) = fonts.Text
End If
Next j
Next i
End Sub
ni idea de donde tengo el error :( :-\ :-\
Seguro que esos rangos están dentro de los límites de la hoja?
Es decir tu le estás diciendo que tienes al menos 6 filas (0-5) de 2 columnas (0-1)... o son 2 filas (0-1) de 6 columnas(0-5)?
Aunque luego al poner i+1, exige que tengas una columa más, 7 ... (0-6)
Luego anecdóticamente veo inútil esto que pones, los valores que quedarán al final, son los que marco con OK, los previos se escriben para acto seguido ser sobrescritos. Con qué finalidad?
Cells(j, i) = title.Text OK
Cells(j, i + 1) = content.Text
Cells(j, i + 1) = dat.Text
Cells(j, i + 1) = fonts.Text OK
En cualquier caso este tma debería ir al hilo de VB... no aquí.