ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   using variable as cell location (https://www.excelbanter.com/excel-programming/286871-using-variable-cell-location.html)

Brad[_14_]

using variable as cell location
 
how can I us a variable as a cell location? ie
Range("c5:variable").Select

Charles Maxson

using variable as cell location
 
Brad,

Not sure if I understand you (and let me know if this is not what you were
asking), but all you need to do to use a variable as the parameter for the
Range object:

Dim sCell As String
sCell = "c5"

Range(sCell).Select

--
Charles
www.officezealot.com


"Brad" wrote in message
...
how can I us a variable as a cell location? ie
Range("c5:variable").Select




Ron de Bruin

using variable as cell location
 
You can use this Brad

Var = 10
Range("c5:c" & Var).Select

or

Var = "C10"
Range("c5:" & Var).Select


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Brad" wrote in message ...
how can I us a variable as a cell location? ie
Range("c5:variable").Select




Niek Otten

using variable as cell location
 
Range(C5).Select

--

Kind Regards,

Niek Otten

Microsoft MVP - Excel

"Brad" wrote in message
...
how can I us a variable as a cell location? ie
Range("c5:variable").Select




Niek Otten

using variable as cell location
 
AH! Now I see what the OPS meant.

--

Kind Regards,

Niek Otten

Microsoft MVP - Excel

"Ron de Bruin" wrote in message
...
You can use this Brad

Var = 10
Range("c5:c" & Var).Select

or

Var = "C10"
Range("c5:" & Var).Select


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Brad" wrote in message

...
how can I us a variable as a cell location? ie
Range("c5:variable").Select






Chip Pearson

using variable as cell location
 
Brad,

It depends on what the variable contains. If it is a string
variable with an address, you can use something like

Range("C5:" & Var).Select


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Brad" wrote in message
...
how can I us a variable as a cell location? ie
Range("c5:variable").Select





All times are GMT +1. The time now is 01:45 PM.

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