Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm looking for a way to refer to a range with a variable. Let me
demonstrate. Dim MyVar MyVar = ActiveCell.Value Range("A14").Select I've tried this: Dim MyVar MyVar = ActiveCell.Value Range("A(MyVar)").Select But (of course) it doesn't work; however this is essentially what I need. How can I make this happen? --- Message posted from http://www.ExcelForum.com/ |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
try sub foo() Dim rng as range set rng = activecell msgbox rng.value end sub -- Regards Frank Kabel Frankfurt, Germany I'm looking for a way to refer to a range with a variable. Let me demonstrate. Dim MyVar MyVar = ActiveCell.Value Range("A14").Select I've tried this: Dim MyVar MyVar = ActiveCell.Value Range("A(MyVar)").Select But (of course) it doesn't work; however this is essentially what I need. How can I make this happen? --- Message posted from http://www.ExcelForum.com/ |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim MyVar as String
Myvar = ActiveCell.Address Range("A14").Select Range(MyVar).Select If you want to select a cell in column A where the specific row number is specified in the activecell myVar - ActiveCell.Value Range("A" & myVar).Select or Cells(ActiveCell.Value, "A").Select -- Regards, Tom Ogilvy "eyecalibrate " wrote in message ... I'm looking for a way to refer to a range with a variable. Let me demonstrate. Dim MyVar MyVar = ActiveCell.Value Range("A14").Select I've tried this: Dim MyVar MyVar = ActiveCell.Value Range("A(MyVar)").Select But (of course) it doesn't work; however this is essentially what I need. How can I make this happen? --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can you name a worksheet by refering to a cell reference or range | Excel Discussion (Misc queries) | |||
Refering to a named range in a chart: 2007 | Excel Worksheet Functions | |||
OFFSET() not working within a SUMPRODUCT() when refering to a range in a pivot table | Excel Worksheet Functions | |||
Change the Range refering to a Name | Excel Discussion (Misc queries) | |||
Simple problem refering to variable in For ... Next loop ... | Excel Programming |