Goto end of data & select all rows below

T

Tempy

Hi,

could somebody help me some code?

I can go to the last cell but i am not sure how to select all rows
below, as i have to delete them.

Tempy

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
T

Tom Ogilvy

Dim rng as Range
set rng = Cells(1,1).End(xlup)(2)
Range(rng,Range("A65536")).EntireRow.delete
 
T

Tempy

Hello Tom,
I think i did not make myself clear enough.

The data varies in amount of rows, so i cannot set the range to a
specific range.
Each time the code runs, it has to test to get the range and then delete
everyting below the data.

Tempy

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
T

Tempy

Hello Tom,
I think i did not make myself clear enough.

The data varies in amount of rows, so i cannot set the range to a
specific range.
Each time the code runs, it has to test to get the range and then delete
everyting below the data.

Tempy

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
T

Tom Ogilvy

sorry - typo

Dim rng as Range
set rng = Cells(rows.count,1).End(xlup)(2)
Range(rng,Range("A65536")).EntireRow.delete

This finds the last filled cell in column A.

If you already have a way to find the row to start deleting, then just use
that and set the result to the range variable rng. then use

Range(rng,Range("A65536")).Entirerow.Delete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top