View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jezebel[_3_] Jezebel[_3_] is offline
external usenet poster
 
Posts: 45
Default variable question

Can't be done. VBA is an compiled language (as opposed to an interpreted
language like vbScript), which has the consequence that the code has no
awareness of its own variable and constant names. That is, you can construct
"vbMonday" as a string; but there's no way to use that string to refer to a
variable or constant with that name.

If you need to convert "Monday" to vbMonday, you need to use some kind of
look up structure, case statement, or equivalent.



"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
want to use a dropdown with the days of the week. if i hard code this it
works

If Weekday(cell.Value) = vbMonday Then

but if i try to concatenate "vb" and the value of the dropdown in A2
(Monday"), it doesn't.

what do i need to do to get it to work?
--


Gary