ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Select always same Rows range (https://www.excelbanter.com/excel-discussion-misc-queries/140582-select-always-same-rows-range.html)

Nauj Solrac

Select always same Rows range
 
I'm trying to select (LastRow+1:500) in many spreadsheets but I got error in
my macro. Example:
Dim LastRow As Long
With ActiveSheet
LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
End With
*ERROR* Rows("LastRow + 1:500").Select <-- *ERROR*
Selection.Delete Shift:=xlUp

Can anyone give and idea to do that selection ? Thanks in advance.

PCLIVE

Select always same Rows range
 
I'm not sure, but I'm guessing you want something like this:

Dim LastRow As Long
With ActiveSheet
LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
End With

Rows(LastRow + 1 & ":500").Select
Selection.Delete Shift:=xlUp


Regards,
Paul

"Nauj Solrac" wrote in message
...
I'm trying to select (LastRow+1:500) in many spreadsheets but I got error
in
my macro. Example:
Dim LastRow As Long
With ActiveSheet
LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
End With
*ERROR* Rows("LastRow + 1:500").Select <-- *ERROR*
Selection.Delete Shift:=xlUp

Can anyone give and idea to do that selection ? Thanks in advance.




Nauj Solrac

Select always same Rows range
 
Great !!! Thank You so much.

"PCLIVE" wrote:

I'm not sure, but I'm guessing you want something like this:

Dim LastRow As Long
With ActiveSheet
LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
End With

Rows(LastRow + 1 & ":500").Select
Selection.Delete Shift:=xlUp


Regards,
Paul

"Nauj Solrac" wrote in message
...
I'm trying to select (LastRow+1:500) in many spreadsheets but I got error
in
my macro. Example:
Dim LastRow As Long
With ActiveSheet
LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row
End With
*ERROR* Rows("LastRow + 1:500").Select <-- *ERROR*
Selection.Delete Shift:=xlUp

Can anyone give and idea to do that selection ? Thanks in advance.






All times are GMT +1. The time now is 02:11 AM.

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