I'm trying to create a simple excel script that pulls values from one worksheet, opens a new worksheet and parses the data as it reads one worksheet and puts it in the appropriate places into the new worksheet. This is what I have so far, but for some reason, the cell assignment statements don't appear.
After debugging, I see that the lines execute, but the values don't appear anywhere in the new worksheet. Any ideas as to why this is happening?
Private Sub CommandButton21_Click()
Dim Active As Worksheet
Set Active = ActiveSheet
Dim ws As Worksheet
Set ws = Sheets.Add
For i = 6 To Cells.Find("*", [A1], , , xlByRows, xlPrevious).Row
If Not IsEmpty(Active.Cells(i, 2).Value) Then
ws.Cells(i - 4, 1).Value = Active.Cells(i - 1, 2).Value
ws.Cells(i, 1).Value = Active.Cells(i - 1, 2).Value
ElseIf Not IsEmpty(Active.Cells(i, 3).Value) Then
...
If Not IsEmpty(Active.Cells(i, 9).Value) Then
...
End If
ElseIf Not IsEmpty(Active.Cells(i, 4).Value) Then
....
End If
Next i
End Sub
Bookmarks