View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Loop thru variables

As was mentioned previously, make an array.

Sub doarray()
myarray = Array("one", "two", "etc")
For Each Item In myarray
MsgBox Item
Next Item
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Madiya" wrote in message
ups.com...
Thanks for your help.
I do not have these list in any of the sheets.
I would like to define the same in the code directly.
I am sure there is a way to do the same.

A little dought in the suggetion by Martin:
What happens if variable defined is 1 to 5 and I have a list only upto
3?
Also the 1st variable in the arrey starts from 0 or 1?

Thanks.
I really appreciate your help.

Regards,
Madiya.