PC Review


Reply
Thread Tools Rate Thread

Assign variable ListBox names

 
 
chris
Guest
Posts: n/a
 
      8th Nov 2006
I have a user form with three list boxes. Is there a "For" statement
(similar to below) that will loop through each of the three list boxes
and execute a "with" command?

For x = 1 to 3
With UserForm1.ListBox(x)
.additem = A
.additem = B
End With
next x

Any help is greatly appreciated, thank you!

 
Reply With Quote
 
 
 
 
Tom Ogilvy
Guest
Posts: n/a
 
      8th Nov 2006
For x = 1 to 3
With UserForm1.Controls("ListBox" & i)
.additem = A
.additem = B
End With
next x

--
Regards,
Tom Ogilvy



"chris" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have a user form with three list boxes. Is there a "For" statement
> (similar to below) that will loop through each of the three list boxes
> and execute a "with" command?
>
> For x = 1 to 3
> With UserForm1.ListBox(x)
> .additem = A
> .additem = B
> End With
> next x
>
> Any help is greatly appreciated, thank you!
>



 
Reply With Quote
 
chris
Guest
Posts: n/a
 
      8th Nov 2006
Is it safe to assume that the "i" should be an "x"? I am also
receiving a Run-time error '438'. Any ideas for a solution?

Thanks!

Tom Ogilvy wrote:
> For x = 1 to 3
> With UserForm1.Controls("ListBox" & i)
> .additem = A
> .additem = B
> End With
> next x
>
> --
> Regards,
> Tom Ogilvy
>
>
>
> "chris" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> >I have a user form with three list boxes. Is there a "For" statement
> > (similar to below) that will loop through each of the three list boxes
> > and execute a "with" command?
> >
> > For x = 1 to 3
> > With UserForm1.ListBox(x)
> > .additem = A
> > .additem = B
> > End With
> > next x
> >
> > Any help is greatly appreciated, thank you!
> >


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Assign JavaScript variable to Jsp Variable Ranjan Microsoft ASP .NET 1 10th Apr 2007 04:35 PM
How to assign the value of the java script variable to a server side variable in C# code behind code? ravindravarman@gmail.com Microsoft Dot NET 0 5th Apr 2007 07:58 AM
Re: Assign a variable from a Listbox selection. Jako Microsoft Excel Programming 1 13th Jun 2004 10:25 AM
Re: Assign a variable from a Listbox selection. Leo Heuser Microsoft Excel Programming 0 13th Jun 2004 09:03 AM
Assign a variable from a Listbox selection. Jako Microsoft Excel Programming 0 13th Jun 2004 08:29 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:56 PM.