Home
|
Contact Us
|
FAQ
|
Search & Site Map
|
Link to Us
Sign In
|
Join
|
Other 45 Sites in Network
Home
Discussions
Access
Excel
InfoPath
Outlook
PowerPoint
Publisher
Word
Directory
User Groups
Related Topics
Outlook Express
Internet Explorer
Windows
MS Server Products
More Topics ...
MS Office Forum
/
Excel
/
New Users
/
September 2007
Tip:
Looking for answers? Try searching our database.
hardcoded values in a loop
Thread view:
Tree View
List View (postings sorted by date)
Single Message View
Enable EMail Alerts
Start New Thread
Thread rating:
Rochel
- 24 Sep 2007 01:24 GMT
Hi,
I want to have something like this in an Excel macro but I don't know how to
write it in VB:
For each val in ("value1", "value2", "value3")
----statements
Next
Does anyone know how to do this?
Signature
Thanks,
Rochel
Reply to this Message
Dave Peterson
- 24 Sep 2007 01:48 GMT
One way:
Dim myVar As Variant
For Each myVar In Array("1", "2", "asdg")
MsgBox myVar
Next myVar
Another way:
dim myVals as Variant
dim iCtr as long
myvals = array("value1", "value2", "value3")
for ictr = lbound(myvals) to ubound(myvals)
msgbox myvals(ictr)
next ictr
> Hi,
>
[quoted text clipped - 9 lines]
> Thanks,
> Rochel
Signature
Dave Peterson
Reply to this Message
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage
Start New Thread
Enable EMail Alerts
Rate this Thread
©2008 Advenet LLC
Privacy Policy
-
Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.