Re: [Excel] Macro to delete
Welcome to the Forums.
Yes, a macro recording will give you the starting point of how Excel would do part of it.
You will want to inclide a few routines like...
Get the row count so you are not going through the entire sheel.
Test for G? cell if its blank.
Delete the row if it is blank.
Code:
Dim i As Long
Dim lRowCount As Long
lRowCount = Workbooks(1).Sheets("Sheet1").Cells.SpecialCells(xlCellTypeLastCell).Row
For i = 1 To lRowCount
If Workbooks(1).Sheets("Sheet1").Cells(i, 7).Value = vbNullString Then
Workbooks(1).Sheets("Sheet1").Rows(i & ":" & i).Delete Shift:=xlUp
End If
Next
Re: [Excel] Macro to delete
thanks for the quick reply, especially with how early in the morning it is over there :D
Ive put this into a macro, however it seems to give me
"run time error 9, subscript out of range" error, when i debug it highlights "lRowCount = Workbooks(1).Sheets("Sheet1").Cells.SpecialCells(xlCellTypeLastCell).Row" line
There are 7590 rows in the spreadsheet im editing
Im do know a bit of vb code, however this is in excel seems to be more confusing
any further advice?
thanks again
Re: [Excel] Macro to delete
no matter, i figured it out, the sheet had been renamed, i just had to change the name
all sorted then, thanks =]