Clearing cells upon making a selection from combo box

pvr928

Well-known Member
Joined
Oct 21, 2002
Messages
790
I am setting up a calculation tool and want to have the contents of certain cells return to zero via the use of a macro once zero is selected from a list in a combo box.

Any ideas on how to do this?

Cheers

pvr928
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

pvr928

Well-known Member
Joined
Oct 21, 2002
Messages
790
Thank you

I assigned a macro to the ComboBox via the right mouse button - it came up as DropDown23 - but it is a ComboBox.

This is what I then typed in Module 1:

Private Sub DropDown23_Change()
If DropDown23.Value = 0 Then
Range("E5").Value = 0
End If
End Sub

It is coming up as having an error in line 2 ("If DropDown23.Value = 0 Then")

Do you know what the problem is?

Cheers

pvr928
 

pvr928

Well-known Member
Joined
Oct 21, 2002
Messages
790
There is no code for the combobox in the sheet where the combobox is located - should there be?

Anyway, I put the code in the sheet, but it told me that it could not find the macro.

I then replaced it into the module, and the same error occurred in line 2.

Cheers

pvr928
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,087
Messages
5,835,308
Members
430,351
Latest member
ddalton

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
Top