moium
03-09-2010, 02:05 PM
Hi there,
I have a worksheet with 'Record' in row 1 and variable names in column A. I need to write a macro that will delete all empty rows. The check should begin from column B, not checking column A. The current code I have (below the table) only checks column B and if the cell is blank, it's respective row is deleted. So in my poor representation of an Excel spreadsheet below, only row 3 would be deleted.
A B C D E F G ....
1 var rcd1 rcd2 rcd3 rcd4 rcd5 rcd6 ....
2 x 0215 0225
3 y
4 z 10 20 30
current code works well but for only a specific column
On Error Resume Next ' In case there are no blanks
Columns("B:B").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
ActiveSheet.UsedRange 'Resets UsedRange for Excel 97
Thanks for any help provided.
Mark
I have a worksheet with 'Record' in row 1 and variable names in column A. I need to write a macro that will delete all empty rows. The check should begin from column B, not checking column A. The current code I have (below the table) only checks column B and if the cell is blank, it's respective row is deleted. So in my poor representation of an Excel spreadsheet below, only row 3 would be deleted.
A B C D E F G ....
1 var rcd1 rcd2 rcd3 rcd4 rcd5 rcd6 ....
2 x 0215 0225
3 y
4 z 10 20 30
current code works well but for only a specific column
On Error Resume Next ' In case there are no blanks
Columns("B:B").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
ActiveSheet.UsedRange 'Resets UsedRange for Excel 97
Thanks for any help provided.
Mark