ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using specifieds in a range (https://www.excelbanter.com/excel-programming/324035-using-specifieds-range.html)

Momo

Using specifieds in a range
 
Hello, Again,

I am using

D = .Range("G2").Value
E = .Range("H2").Value

to give me two cell references (as values from the cells G2 and H2) which i
then want to use to form a range by something like

..Range(A:B).value
but this doesn't work so is obviously wrong, can anyone help,

thanks

Andy


Momo

Using specifieds in a range
 


in addition, yes i have jus realised i left out the"" but this is bringing
up an error when i run the macro,
..Range ("A1:R4") & .Range("D:E").Select

where D and E are as previous and A1 to R4 is a seperate range

Tom Ogilvy

Using specifieds in a range
 
.Range(D & ":" & E).Value

--
Regards,
Tom Ogilvy

"Momo" wrote in message
...
Hello, Again,

I am using

D = .Range("G2").Value
E = .Range("H2").Value

to give me two cell references (as values from the cells G2 and H2) which

i
then want to use to form a range by something like

.Range(A:B).value
but this doesn't work so is obviously wrong, can anyone help,

thanks

Andy




Toppers

Using specifieds in a range
 
The following works:

Sub test()

D = Range("G2").Value ' Contains A1
E = Range("H2").Value ' Contains B6
Range(D & ":" & E).Select ' Range("A1:B6") is selected

End Sub

HTH

"Momo" wrote:



in addition, yes i have jus realised i left out the"" but this is bringing
up an error when i run the macro,
.Range ("A1:R4") & .Range("D:E").Select

where D and E are as previous and A1 to R4 is a seperate range



All times are GMT +1. The time now is 08:53 PM.

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