Reputation: 353
I have the following code. I debugged and got that the problem is with the IF inside the for.
The exact error is: Run Time Error 438 - Object Doesn't Support this Property or Method
Any clues what it could be? I appreciate any help. Thanks!
Sub dimensiones()
Dim Hoja1 As Object
Dim Hoja2 As Object
Set Hoja1 = Worksheets("INPUT")
Set Hoja2 = Worksheets("OUTPUT")
Dim inicio_filas As Integer
Dim col_s1 As Integer
Dim col_s2 As Integer
Dim limite_filas As Integer
Dim m As Integer
col_s1 = 38
col_s2 = col_s1 + 2
inicio_filas = 3
limite_filas = 1000
Dim k As Integer
k = inicio_filas
For i = inicio_filas To limite_filas
For m = 1 To col_s2 - 1
Hoja2.Cells(k, m) = Hoja1.Cells(i, m)
Next m
k = k + 1
If Hoja1(i, col_s2) <> "" Then
For m = 1 To col_s1 - 1
Hoja2.Cells(k, m) = Hoja1.Cells(i, m)
Next m
Hoja2.Cells(k, col_s2) = Hoja1.Cells(i, col_s2)
Hoja2.Cells(k, col_s2 + 1) = Hoja1.Cells(i, col_s2 + 1)
Hoja2.Cells(k, col_s2 + 2) = Hoja1.Cells(i, col_s2 + 2)
k = k + 1
End If
Next i
End Sub
Upvotes: 0
Views: 78
Reputation: 353
Got it, noob error but forgot the Cells command missing when looking for Hoja1.Cells(i,col_s2)
Thanks!
Upvotes: 1