By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,903 Members | 1,977 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,903 IT Pros & Developers. It's quick & easy.

Read worksheet name, use as variable

P: 1
Probably an easy question for some. I'm trying to read the worksheet name, then use that name as a variable reference. Got this to work as a function with evaluate:

function A()
A = "255 plus characters"
end function
sub callit()
evaluate(activesheet.name & "()")
end sub
but the 255 char limit ended that...

basically, looking for a more elegant way to write:
A = "255 plus characters"
B = "255 plus characters"
if activesheet.name = "A" then A
if activesheet.name = "B" then B

note: A and B are sql statements, so i'm trying to dynamically choosing the appropriate query for a given active sheet.
Aug 17 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.