![]() |
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 |
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 |
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. |
All times are GMT +1. The time now is 10:28 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com