Insert blank row on two conditions
- by lost_my_wallet_in_el_segundo
I have a spreadsheet with a large number of rows. There are two rows grouped together (for each customer). In column A, the first row has an account number. The second row should be blank.
The spreadsheet has lots of customers listed where there is no second row. I need to insert a blank line to create a second row for each customer that doesn't have one.
Here is the VBA script I cobbled together, but it gets a syntax error.
Sub Macro1()
'
' Macro1 Macro
'
For myrow = 1 To Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
If Cells(myrow, 1) <> "" and Cells(myrow+1, 1) <> ""
Then
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
End Sub