Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is it possible to use variables in a "Set" statement?
For example, I have the following lines: With Worksheets("Lookup") Set General_kV = ("Lookup").Range("General_kV") Set General_mA = .Range("General_mA") Set General_Timer = .Range("General_Timer") (...etc. approx 90 other Set statements). End With I can recover the named ranges from the Lookup worksheet but I don't know how (or if) it's possible to apply them to a variable in the Set statement. What I'm hoping for is something along the lines of the following code but I need both instances of X to be substituted with General_kV, General_mA, General_Timer, etc. Sub SetRanges() Set nms = ThisWorkbook.Names For r = 1 To nms.Count X = nms(r).Name If Left(nms(r).RefersTo, 8) = "=Lookup!" Then Set X = Worksheets("Lookup").Range(X) End If Next Set nms = Nothing End Sub Any ideas? -- Ian -- |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
Read ".dll" files, the Macro "work flow" and the actual values of the variables when Macro is running | Excel Programming | |||
embedding "ISERROR" function into an "IF" statement | Excel Worksheet Functions | |||
Call a sub statement in "Personal Macro Workbook" from "ThisWorkbo | Excel Programming | |||
vba: How do I write a "For Each Statement" nested in a "With Statement"? | Excel Programming |