Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Put items in combobox using VBA and toolbox


I wish to create a simple drop down menu using VBA. I do not wish to pu
an array of the item names to one side of the spreasheet and link t
that, but put the item names in by using VBA . I am not working from
UserForm, but using Toolbox and the VB Editor.

I have created a combobox as a start :)

So far I have tried the following without success:

Private Sub Forms.ComboBox1_Change()
With ComboBox1
.ListFillRange = ""
'.AddItem "X"
'.AddItem "Y"
'.AddItem "Z"
'.AddItem "X2"
'.AddItem "Y2"
'.AddItem "Z2"
End With

End Sub

All assistance and suggestions gratefully accepte

--
JoeS0
-----------------------------------------------------------------------
JoeS01's Profile: http://www.excelforum.com/member.php...nfo&userid=981
View this thread: http://www.excelforum.com/showthread.php?threadid=38271

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Put items in combobox using VBA and toolbox


The ' before the AddItem lines are not there in my code - it was
leftover form my testin

--
JoeS0
-----------------------------------------------------------------------
JoeS01's Profile: http://www.excelforum.com/member.php...nfo&userid=981
View this thread: http://www.excelforum.com/showthread.php?threadid=38271

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Put items in combobox using VBA and toolbox


The ' before the AddItem lines are not there in my code - it was
leftover from my testing :eek

--
JoeS0
-----------------------------------------------------------------------
JoeS01's Profile: http://www.excelforum.com/member.php...nfo&userid=981
View this thread: http://www.excelforum.com/showthread.php?threadid=38271

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Put items in combobox using VBA and toolbox

The code would look something like this

Sub ComboBox1_Load()
With ComboBox1
.AddItem "X"
.AddItem "Y"
.AddItem "Z"
.AddItem "X2"
.AddItem "Y2"
.AddItem "Z2"
.ListIndex = 0
End With
End Sub

You would have a separate routine to load it at start, unlikely to use an
event procedure to load it.

--
HTH

Bob Phillips

"JoeS01" wrote in
message ...

I wish to create a simple drop down menu using VBA. I do not wish to put
an array of the item names to one side of the spreasheet and link to
that, but put the item names in by using VBA . I am not working from a
UserForm, but using Toolbox and the VB Editor.

I have created a combobox as a start :)

So far I have tried the following without success:

Private Sub Forms.ComboBox1_Change()
With ComboBox1
ListFillRange = ""
'.AddItem "X"
'.AddItem "Y"
'.AddItem "Z"
'.AddItem "X2"
'.AddItem "Y2"
'.AddItem "Z2"
End With

End Sub

All assistance and suggestions gratefully accepted


--
JoeS01
------------------------------------------------------------------------
JoeS01's Profile:

http://www.excelforum.com/member.php...fo&userid=9816
View this thread: http://www.excelforum.com/showthread...hreadid=382714



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
Control ToolBox ComboBox Steve D Excel Discussion (Misc queries) 1 July 1st 09 05:17 PM
Format the items in a combobox 0000_AAAA_0000[_7_] Excel Programming 1 November 2nd 04 01:13 AM
how to add items to combobox Marek Excel Programming 3 August 30th 04 10:31 AM
ComboBox Items Todd Huttenstine[_2_] Excel Programming 1 December 14th 03 11:12 PM
ComboBox items Keith Willshaw Excel Programming 2 July 17th 03 11:22 AM


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

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

About Us

"It's about Microsoft Excel"