![]() |
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)) |
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 |
All times are GMT +1. The time now is 09:19 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com