hello,
i'm trying to do an if go to fuction inside a for loop and i get an error.
please help me understand what i did wrong.
i'm trying to do an if go to fuction inside a for loop and i get an error.
please help me understand what i did wrong.
VBA Code:
Sub CopyToMaster()
Dim destination As Worksheet
Dim emptyColumn As Long
Dim j As Long
Dim cell As Range
Set destination = Sheets("MASTER")
ShtCount = ActiveWorkbook.Sheets.Count
For i = 3 To ShtCount
Worksheets(i).Activate
If Range("C2,A7:J31").SpecialCells(xlCellTypeConstants).Select Is Nothing Then
GoTo line2
Else: GoTo line1
End If
line1:
Range("C2,A7:J31").SpecialCells(xlCellTypeConstants).Select
emptyColumn = destination.Cells(1, i - 2).Column
j = 0
For Each cell In Selection
destination.Cells(emptyColumn).Offset(j).Value = cell.Value
j = j + 1
Next cell
line2:
Next i
Worksheets("MASTER").Activate
End Sub