ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Goto end of data & select all rows below (https://www.excelbanter.com/excel-programming/300044-goto-end-data-select-all-rows-below.html)

Tempy

Goto end of data & select all rows below
 
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!

Tom Ogilvy

Goto end of data & select all rows below
 
Dim rng as Range
set rng = Cells(1,1).End(xlup)(2)
Range(rng,Range("A65536")).EntireRow.delete

--
Regards,
Tom Ogilvy

"Tempy" wrote in message
...
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!




Tempy

Goto end of data & select all rows below
 
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!

Tempy

Goto end of data & select all rows below
 
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!

Tom Ogilvy

Goto end of data & select all rows below
 
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

--
Regards,
Tom Ogilvy


"Tempy" wrote in message
...
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!




Tempy

Goto end of data & select all rows below
 
Thank you Tom.

You guys really do a great job.

Tempy

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


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

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