Help with Macro Code

markster

Well-known Member
Joined
May 23, 2002
Messages
579
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hello
I need help with a bit of Macro code. I have managed to figure out most of it by recording and trial and error. The only thing I can't figure out is a line of code that should look down A and any blank cells in column A it deletes the entire row. E.g. A7 might be blank so it deletes the entire row, A9 maybe blank so it deletes the entire row. A11 might be blank so it deletes the entire row. Any blank cells may be shaded but that doesn't matter - if there is not a value in an A cell then it should delete the entire row regardless of whether it is shaded or not.

Thanks
Mark
 
Last edited:

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
How about
VBA Code:
Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row).SpecialCells(xlCellTypeBlanks).EntireRow.Delete

If you have blank cells at the bottom which that doesn't pick up, you might want to use
VBA Code:
ActiveSheet.UsedRange.Columns(1).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
instead
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,853
Members
449,051
Latest member
excelquestion515

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top