Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Using variables as first and last cells in range statement
How do you specify the 'RANGE(a:b).SELECT' statment using only
variables. I keep getting syntax errors when I attempt the following: Dim endcell As String endcell = Range("D65535").End(xlUp).Row Dim firstcell As String firstcell = Range(FinalRow - 4).Select Range(firstcell:endcell).Select |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Using variables as first and last cells in range statement
A couple of ways below. Keep in mind that you do not need Select
statements to do most actions ... Sub fooL() Dim EndCell As Long EndCell = Cells(Rows.Count, "D").End(xlUp).Row Range("D" & FirstCell & ":D" & EndCell - 4).Select End Sub Sub fooR() Dim EndCell As Range Set EndCell = Cells(Rows.Count, "D").End(xlUp) Range(EndCell.Offset(-4, 0), EndCell).Select End Sub |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Using variables as first and last cells in range statement
It seems to work. Thanks for your help. I'm learning by the trial
and error method. This is my first google group question and I'm impressed by the quick response. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|