Delete rows between startRow$ and endRow$

zombiemaster

Board Regular
Joined
Oct 27, 2009
Messages
245
Hi, All...

Thought this would be easy: mark startRow$ and endRow$, select those rows and delete. But NOOO of course it couldn't be THAT easy...

This is what I tried:

Code:
    Range("A100000").Select
    Selection.End(xlUp).Select
    ActiveCell.Offset(-4, 0).Select
    endRow$ = ActiveCell.Row
    ActiveCell.Offset(0, 2).Select
    Selection.End(xlUp).Select
    ActiveCell.Offset(2, 0).Select
    startRow$ = ActiveCell.Row

At that point I'm stuck. How do I select the range of row from startRow$ to endRow$ and delete those entire rows?

Feeling like a Monday here...oh yeah, it IS a Monday! :eeek:

Thanks as always,
~ZM~
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Try
Code:
    EndRow$ = Range("A" & Rows.Count).End(xlUp).Offset(-4, 0).Row
    startrow$ = Cells(EndRow$, 3).End(xlUp).Row
   Rows(startrow$ & ":" & EndRow$).Delete
 
Upvote 0
Hi, Fluff...

Thanks for your response. If I'm reading this right, it's finding the last row and calling that the endRow, correct? If that's the case then I should have mentioned that there is data BELOW where I'm setting the endRow$ - that's why I "find up" from A100000 and offset up from there to find my 'real' end row of where I want to delete the rows. Does that change what you showed me?

~ZM~
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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