Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This works:
Dim myRange As Range Set myRange = Worksheets("Collection").Range("H2:H4") But the change below doesn't work for some reason and presents an error: Dim refColumn As String Dim myRange As Range refColumn = "H" Set myRange = Worksheets("Collection").Range(refColumn & "2:" & refColumn & "4") What have I done wrong? Thanks in advance. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
try
.range(cells(2,refcolumn),cells(4,refcolumn)) -- Don Guillett Microsoft MVP Excel SalesAid Software "jbarrington" <"jbarrington -at- comcast period net" wrote in message ... This works: Dim myRange As Range Set myRange = Worksheets("Collection").Range("H2:H4") But the change below doesn't work for some reason and presents an error: Dim refColumn As String Dim myRange As Range refColumn = "H" Set myRange = Worksheets("Collection").Range(refColumn & "2:" & refColumn & "4") What have I done wrong? Thanks in advance. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That Set statement works fine for me (as it should) on my copy of XL2003.
Just out of curiosity, what error message are you getting? Are you sure the Set statement is where your error is occurring at (that is, did you single step through your code to see where the error pops up at)? -- Rick (MVP - Excel) "jbarrington" <"jbarrington -at- comcast period net" wrote in message ... This works: Dim myRange As Range Set myRange = Worksheets("Collection").Range("H2:H4") But the change below doesn't work for some reason and presents an error: Dim refColumn As String Dim myRange As Range refColumn = "H" Set myRange = Worksheets("Collection").Range(refColumn & "2:" & refColumn & "4") What have I done wrong? Thanks in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
What is wrong with this range??? | Excel Programming | |||
right code, wrong range | Excel Programming | |||
Range in wrong book | Excel Programming | |||
histogram, wrong input range | Excel Discussion (Misc queries) | |||
deleting wrong range! | Excel Programming |