delete rows

james potter

New Member
Joined
Aug 15, 2005
Messages
45
I working on a little project but can not find a solution for a small problem.
I tried but did not succeed. So could anyone assist my?

I have a table with data, for instance, from A1 to F9, this range can change in size due to data import. The last two lines start with their data in column B. I want those rows to be deleted if they have data in column B and not in column A. I know how to code to go to the last edit cell in column A and one down. But I do not know how to make the row variabel in my code. Was the code for this part?

An other project I am working is almost the same but not with the B column part. I just want to go to the last edit cell in column A and every row under that cell can be deleted. Was it the code for this part?

Thanks sofar
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
The Range object's EntireRow property will return the entire row for that Range. Then you can use the Delete method. Example:

Range("A1").End(xlDown).Offset(1, 0).EntireRow.Delete
 

james potter

New Member
Joined
Aug 15, 2005
Messages
45
Thanks for your effort. This was just what I need. A push in the right direction. It's working now.
 

Forum statistics

Threads
1,136,310
Messages
5,675,002
Members
419,543
Latest member
Casp

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
Top