Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default What am I doing wrong with this VBA range?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default What am I doing wrong with this VBA range?

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is wrong with this range??? Geoff ML[_2_] Excel Programming 3 July 8th 08 07:38 PM
right code, wrong range Ray Excel Programming 2 March 22nd 07 02:13 PM
Range in wrong book Newbie Excel Programming 5 February 8th 07 02:38 PM
histogram, wrong input range Camilla Excel Discussion (Misc queries) 1 November 11th 05 07:21 AM
deleting wrong range! gavmer[_44_] Excel Programming 3 July 2nd 04 02:08 AM


All times are GMT +1. The time now is 11:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"