I have adapted an array sub off of the forum where I want to strip away 4 of the 9 columns. I'm using an If & ElseIf decision to detect the column number and it works for the first two columns but hangs up after that. If someone would look at the attached workbook & let me know where I'm going wrong, I would appreciate it.
Sub Macro1()
For i = 1 To LastRow
For j = 1 To LastCol
DataArray(i, j) = Worksheets("Sheet1").Cells(i, j)
Next j
Next i
For i = 1 To LastRow
For j = 1 To 9
If j = 1 Then
Worksheets("Sheet2").Cells(i, j) = DataArray(i, j)
ElseIf j = 3 Then
Worksheets("Sheet2").Cells(i, j - 1) = DataArray(i, j)
ElseIf j = 6 Then
Worksheets("Sheet2").Cells(i, j - 3) = DataArray(i, j)
ElseIf j = 9 Then
Worksheets("Sheet2").Cells(i, j - 4) = DataArray(i, j)
Else:
End If
Next j
Next i
End Sub[/SIZE]
Bookmarks