Run macro when any ComboBox within a Userform changes

lancs83

New Member
Joined
Apr 23, 2021
Messages
7
Platform
  1. Windows
Hi,

Hoping someone can help with this please.

I recently received some great help from a member on this message board around conditionally formatting userforms comboboxes when any of the comboboxes within the userform changed. I now need to extend this a little by being able to run a piece of code whenever any of the comboboxes are changed. So would hopefully look a little like this:

If any combobox.value is changed then
unload me
userform6.show

Any help would be greatly appreciated,
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Why don't you post your current code under ComboBox change event?
Rich (BB code):
Private Sub ComboBox1_Change()

<Put the program to execute when ComboBox changed here>

End Sub

You can just add your code there to execute whatever code you want to execute. The step above is not clear. When ComboBox changes value
Unload Me
UserForm6.Show

You want to unload the UserForm that hold the current ComboBox and show another UserForm?
 
Upvote 0
Hi Zot,

Sorry for the ambiguity.

So my userform is a job booking tool and will have over 100 comboboxes. When any of the cbs is updated I want to run my code which is basically just:
Activecell.offset(0,1).value = combobox1.value
Textbox1.value = activecell.offset(0,2).value
Where the activecell is selected based on a search of a textbox value within the same user form.

Dim ws As Worksheet
Dim Rng As Range
Set ws = Sheets("INSTALL")
Set Rng = ws.Range("A:A").Find(Me.ComboBox1.Value, LookIn:=xlValues)
If Not Rng Is Nothing Then
ws.Activate
Rng.Select
Else
End If

The userform in question is Userform6 , so the unload me and Userform6.show commands are simply refreshing my userform after the relevant data has been added to my Install sheet.
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,276
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top