Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have created a combo box by selecting a cell and using Data<Validation<List
and selecting values on a different worksheet. I would like for when a user selects a value from the combobox, for a VBA function to run (to change certain cell properties). Is this possible??? Thank you very much. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Assuming your combobox is in cell G2, in the worksheet code try something like:
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$G$2" Then Range("G5") = Target.Value 'do something with value End If End Sub -- Les Torchia-Wells "Todd in Dayton" wrote: I have created a combo box by selecting a cell and using Data<Validation<List and selecting values on a different worksheet. I would like for when a user selects a value from the combobox, for a VBA function to run (to change certain cell properties). Is this possible??? Thank you very much. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Right click on the sheet tab of the sheet with the dropdown datavalidation
and select view code. Put in code like this Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo ErrHandler If Target.Address = "$B$9" Then Application.EnableEvents = False Call MyMacro End If ErrHandler: Application.EnableEvents = True End Sub As written, this reacts to changes in cell B9. The code you want to run should be in a subroutine in a general module in the workbook and have the name mymacro (of course that can be changed as can the cell reference). Note that this will not work in xl97 and earlier. -- Regards, Tom Ogilvy "Todd in Dayton" wrote: I have created a combo box by selecting a cell and using Data<Validation<List and selecting values on a different worksheet. I would like for when a user selects a value from the combobox, for a VBA function to run (to change certain cell properties). Is this possible??? Thank you very much. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Combo Box Showing Date Selections | Excel Discussion (Misc queries) | |||
Counting Combo Drop Down Box Selections | Excel Worksheet Functions | |||
Can List or Combo Box have multiple selections? | Excel Worksheet Functions | |||
A Challenge (Linking word and Excel) | Excel Programming | |||
Multiple Selections in a Combo Box??? | Excel Programming |