Select range First Row to Last Row

sh1pley

Board Regular
Joined
Dec 22, 2006
Messages
160
FirstRow = Range("L1").End(xlDown).Row
FinalRow = Range("L65536").End(xlUp).Row

The range I want select in this case is from B14 to L80. However I do not know how to include "First Row" into the VBA code?

Range("B14:L" & FinalRow).Select
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Perhaps

Code:
Range("B" & FirstRow & ":L" & FinalRow).Select

But why do you need to Select the range to work with it?
 
Upvote 0
Something like:

Code:
Range("B" & FirstRow & ":L" & FinalRow).Sort Key1:=Range("B" & FirstRow), Order1:=xlAscending, Key2:=Range("C" & FirstRow _
        ), Order2:=xlAscending, Key3:=Range("D" & FirstRow), Order3:=xlAscending, Header _
        :=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

will sort without selecting.
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,857
Members
449,051
Latest member
excelquestion515

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