Hey there all, thanks in advance for any help to get me over an early vba hurdle. I'm trying to loop through pasted trade confirmations from my broker. Relevant info:
-rows 1-7 are above my dataset area, command buttons etc.
-column 2 is "Buy/Sell".
-It imports cleanly except for misc notes on dividends etc that I wish to delete to just keep a clean dataset of trade confirmations.
Since I only want trade records and want to eliminate other notes etc that paste over from the copied info, looking for either "is empty" or <> buy or sell seems to be the best way to do it. It doesn't work though... it deletes about half of them. When I run it again, it then deletes the remainder. What am I doing wrong???
Here's my code:
Sub Schwab_Trades_Process()
'Click immediately after copying schwab trade confirmations
ActiveSheet.Paste
Selection.UnMerge
Selection.WrapText = False
Dim rowcnt As Integer
rowcnt = Selection.Rows.Count
Dim loopcnt As Integer
For loopcnt = 8 To rowcnt
If IsEmpty(Cells(loopcnt, 2)) Then
Cells(loopcnt, 2).EntireRow.Delete
End If
Next loopcnt
End Sub
Many thanks in advance...
Kevin
-rows 1-7 are above my dataset area, command buttons etc.
-column 2 is "Buy/Sell".
-It imports cleanly except for misc notes on dividends etc that I wish to delete to just keep a clean dataset of trade confirmations.
Since I only want trade records and want to eliminate other notes etc that paste over from the copied info, looking for either "is empty" or <> buy or sell seems to be the best way to do it. It doesn't work though... it deletes about half of them. When I run it again, it then deletes the remainder. What am I doing wrong???
Here's my code:
Sub Schwab_Trades_Process()
'Click immediately after copying schwab trade confirmations
ActiveSheet.Paste
Selection.UnMerge
Selection.WrapText = False
Dim rowcnt As Integer
rowcnt = Selection.Rows.Count
Dim loopcnt As Integer
For loopcnt = 8 To rowcnt
If IsEmpty(Cells(loopcnt, 2)) Then
Cells(loopcnt, 2).EntireRow.Delete
End If
Next loopcnt
End Sub
Many thanks in advance...
Kevin