Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
VBA doesn't allow you to create variable names this way. But you don't have to,
either. You can use Arithmetic. Maybe... Maybe: msgbox "day_" & date + nn or msgbox "day_" & date + (nn * 7) or with formatting: msgbox "day_" & format(date + nn, "dd-mmm-yyyy") or msgbox "day_" & format(date + (nn * 7), "dd-mmm-yyyy") On 07/25/2011 21:35, LiCal wrote: I am testing two variables of similarly named and sequentially numbered through a do..loop. I know that I can do that via var() array. but if I want to change the variable name via string changes, how to do it? ....... day_1 = date day_2 = dateadd("d", 7, day_1) nn=1 do msgbox "day_"& nn ' not working this way, nn= nn+1 loop until nn=3 ............ ........ -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Loop with variable name? | Excel Discussion (Misc queries) | |||
Loop with Variable name? | Excel Programming | |||
loop for-next with variable end | Excel Programming | |||
Change cut/paste operation to cut/insert operation | Excel Programming | |||
For Each ... Next loop - need to reference the loop variable | Excel Programming |