ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Drop Down Menu (https://www.excelbanter.com/excel-programming/351997-drop-down-menu.html)

cedtech23[_2_]

Drop Down Menu
 

How do you create a drop down menu in VBA

example a menu with the following options

Black
Red
Gree

--
cedtech2
-----------------------------------------------------------------------
cedtech23's Profile: http://www.excelforum.com/member.php...fo&userid=3102
View this thread: http://www.excelforum.com/showthread.php?threadid=50696


Bob Phillips[_6_]

Drop Down Menu
 
Goto menu DataValidation, set Allow to List, and enter the values as comma
delimited list

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"cedtech23" wrote in
message ...

How do you create a drop down menu in VBA

example a menu with the following options

Black
Red
Green


--
cedtech23
------------------------------------------------------------------------
cedtech23's Profile:

http://www.excelforum.com/member.php...o&userid=31022
View this thread: http://www.excelforum.com/showthread...hreadid=506963




cedtech23[_3_]

Drop Down Menu
 

thank you for the response... I really wanted to know how to do that i
the VBA enviroment with a form. sorry I was not clea

--
cedtech2
-----------------------------------------------------------------------
cedtech23's Profile: http://www.excelforum.com/member.php...fo&userid=3102
View this thread: http://www.excelforum.com/showthread.php?threadid=50696


Bob Phillips[_6_]

Drop Down Menu
 
With Userform.Listbox1
.AddItem "Black"
.AddItem "Red"
.AddItem "Green"
End With

or

With Userform.Combobox1
.AddItem "Black"
.AddItem "Red"
.AddItem "Green"
End With

--

HTH

Bob Phillips

(remove nothere from the email address if mailing direct)

"cedtech23" wrote
in message ...

thank you for the response... I really wanted to know how to do that in
the VBA enviroment with a form. sorry I was not clear


--
cedtech23
------------------------------------------------------------------------
cedtech23's Profile:

http://www.excelforum.com/member.php...o&userid=31022
View this thread: http://www.excelforum.com/showthread...hreadid=506963




L. Howard Kittle

Drop Down Menu
 
From the macro recorded:

Sub Macro12()

With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=
_
xlBetween, Formula1:="=$A$1:$A$3"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End Sub

HTH
Regards,
Howard

"cedtech23" wrote in
message ...

How do you create a drop down menu in VBA

example a menu with the following options

Black
Red
Green


--
cedtech23
------------------------------------------------------------------------
cedtech23's Profile:
http://www.excelforum.com/member.php...o&userid=31022
View this thread: http://www.excelforum.com/showthread...hreadid=506963





All times are GMT +1. The time now is 10:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com