Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default manipulating controls

I have a bunch of comboboxes i would like to set the values to before my form
loads based on how big a range is but i want to be able to run through all
combo boxes with having to write a block for each ...... using some code i
seen in a book i wrote this and thought that this might work ...

any suggestions



Dim mycontrol As Control

Load ISBN

For Each mycontrol In Controls
If Left(mycontrol.Name, 5) = "Combo" Then
For Fill = 0 To a - 1
With mycontrol
Dim nextitem As Integer
nextitem = 65 + Fill
.AddItem Chr(nextitem)
End With
Next Fill
End If
Next

ISBN.Show
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default manipulating controls

I think it would depend on what you want each combobox set to.

If you always want the first item in the list, you could change each of the
..listindex properties to 0. If you wanted something more complex, it might make
more sense to just populate each combobox with the value you want.



Robin Krupp wrote:

I have a bunch of comboboxes i would like to set the values to before my form
loads based on how big a range is but i want to be able to run through all
combo boxes with having to write a block for each ...... using some code i
seen in a book i wrote this and thought that this might work ...

any suggestions

Dim mycontrol As Control

Load ISBN

For Each mycontrol In Controls
If Left(mycontrol.Name, 5) = "Combo" Then
For Fill = 0 To a - 1
With mycontrol
Dim nextitem As Integer
nextitem = 65 + Fill
.AddItem Chr(nextitem)
End With
Next Fill
End If
Next

ISBN.Show


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Manipulating Controls on a worksheet David Looney[_2_] Excel Programming 1 June 26th 06 08:05 PM
Excel controls vs vba controls cmpcwil2[_6_] Excel Programming 3 April 19th 06 03:33 PM
ActiveX Controls vs Form Controls Alex Excel Discussion (Misc queries) 1 January 11th 06 08:46 AM
creating/manipulating form controls placed on a spreadsheet in excel using vba [email protected] Excel Programming 2 August 15th 05 02:07 AM
Event procedures for controls added with Controls.Add John Austin[_4_] Excel Programming 1 March 9th 05 03:31 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"