Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Want to Change Range Selected in Formula

I would like to pass a variable through a function. Based on the value, I
have some ranges already name ie. Dataquestion#. I would like to be able to
change the named range to use in this formula based on numbers, such as mQNo.

Any help would be appreciated.

mQNo = 1
Set mQuestionRange1 = Worksheets("Data").Range(Chr(34) & "DataQuestion" &
mQNo & Chr(34))
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Want to Change Range Selected in Formula


This is siomple. I don't think you understadn strings. You don't need
a second set of double quotes. It is that simple

for example

Var1 = "abc"
Var2 = "def"

Var12 & Var2 will equal "abcdef"

You don't need to do this
chr(34) & Var1 & Var2 & chr(34)
It would results in this
""abcdef""

Likewise this is wrong
Set mQuestionRange1 = Worksheets("Data").Range(Chr(34) & "DataQuestion"
& mQNo & Chr(34))

Instead use this
Set mQuestionRange1 = Worksheets("Data").Range("DataQuestion" & mQNo)


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=157316

Microsoft Office Help

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
Fill range don't change the formula, Help was no help. Please hel Trussell Excel Worksheet Functions 3 October 19th 08 04:30 AM
change text case of some selected words from formula bar. al Excel Programming 3 October 24th 05 06:22 AM
how do i create a formula for selected range? Yin Excel Worksheet Functions 5 September 28th 05 04:55 AM
How can you change the color of the selected range? Andrew Excel Discussion (Misc queries) 2 June 30th 05 07:37 PM
Change value of each cell in selected range by percentage Aaron Excel Programming 1 December 15th 04 08:16 PM


All times are GMT +1. The time now is 04:58 PM.

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

About Us

"It's about Microsoft Excel"