View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
KelliInCali KelliInCali is offline
external usenet poster
 
Posts: 37
Default VB code for selecting all rows below filled column

Ok... when I select the range manually and delete it, the code works. But
the selection and delete is what I am wanting the code to do in the first
place. Is there a way to make it work when B is not totally blank?

kelli

"Ron de Bruin" wrote:

Hi kelli

If there is a space in the cell the cell is not empty
You can select the range that you think is empty and push the delete button

Then try the macro again



--
Regards Ron de Bruin
http://www.rondebruin.nl



"KelliInCali" wrote in message ...
A quick check of next cell '=IF(B588="","empty","not")' returns "not empty"

??

"Ron de Bruin" wrote:

The code find the last cell with data in B and add one row
I think your cells are not empty ?


--
Regards Ron de Bruin
http://www.rondebruin.nl



"KelliInCali" wrote in message ...
Ron... Thanks, but doesn't seem to do the trick. When I sort B, I am left
with random data in various cols in rows below last data in B. So I need to
delete all rows after last "B" data. This doesn't seem to work for that.

Manually, I just do Ctrl/Shift/Dwn "B" to find last row, then select very
next row and Ctrl/Shft/Dwn again to select from there to 65536 and then
delete. But I cannot figure out how to duplicate that in macro.

-kelli

"Ron de Bruin" wrote:

Hi KelliInCali

Try this

Dim lr As Long
lr = Range("B" & Rows.Count).End(xlUp).Offset(1, 0).Row
Range("A" & lr & ":IV" & Rows.Count).Delete


--
Regards Ron de Bruin
http://www.rondebruin.nl



"KelliInCali" wrote in message
...
Hi. I need to delete data in all the rows below the last filled row for
column B. Can anyone give me code for that? Thanks in advance, Kelli