ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   removing rows that have a blank column B only (https://www.excelbanter.com/excel-programming/335680-removing-rows-have-blank-column-b-only.html)

savbci

removing rows that have a blank column B only
 
I would like to run a macro to do as follows.
on a day to day basis I'm given a spreadsheet. The headers/columns are all
the same. I sort column 'B' which is the key information I need. Anything
blank in column B is useless to me. So I highlight all the rows that have a
blank column B and delete them. obviously with every spreadsheets sometimes
there's only 2 rows to be deleted and sometimes there's 200. is there a way
to write a macro that would do this automatically for me, instead of having
to do this manual everyday.

I tried using Selection.End(xlDown) but it takes me to the bottom of all the
records.
all of column A has a value, and sometimes column C has a value (if this
helps).


Norman Jones

removing rows that have a blank column B only
 
Hi Savbci,

Try:

Sub Tester()

On Error Resume Next
Columns("B:B").SpecialCells(xlBlanks).EntireRow.De lete
On Error GoTo 0

End Sub

---
Regards,
Norman



"savbci" wrote in message
...
I would like to run a macro to do as follows.
on a day to day basis I'm given a spreadsheet. The headers/columns are all
the same. I sort column 'B' which is the key information I need. Anything
blank in column B is useless to me. So I highlight all the rows that have
a
blank column B and delete them. obviously with every spreadsheets
sometimes
there's only 2 rows to be deleted and sometimes there's 200. is there a
way
to write a macro that would do this automatically for me, instead of
having
to do this manual everyday.

I tried using Selection.End(xlDown) but it takes me to the bottom of all
the
records.
all of column A has a value, and sometimes column C has a value (if this
helps).





All times are GMT +1. The time now is 06:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com