How to Clear a Drop-Down selection whit a button

Capy_Uther

New Member
Joined
May 14, 2023
Messages
16
Office Version
  1. 365
Platform
  1. Windows
Hello to everyone on my excel im using a button to clear cells everytime i click it:

Sub BorrarTodo()

x = MsgBox("Se borrará todo el contenido de esta cotización", vbYesNo, "Eliminar Fila")

If x = vbYes Then
Range("G5").ClearContents
Range("A18:C44").ClearContents
Range("G4").Value = Range("G4") + 1

End If
End Sub

But on cells E18 to E44 are all drop down options, rite now when anything is selected on any of those drop downs manualy i go 1 by 1 and click the 1st option on the drop-down menu to make them blank again

1684345212005.png


Is there a way to use the same Clear button for reset to blank E18 to E44 cells ?
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Is that "blank" option at the top of your drop-down list REALLY empty, or is it something like a single space?

So, if you chose the blank option for cell E18, and then entered this formula in any blank cell, what does it return?
Excel Formula:
=LEN(E18)
 
Upvote 0
Is that "blank" option at the top of your drop-down list REALLY empty, or is it something like a single space?

So, if you chose the blank option for cell E18, and then entered this formula in any blank cell, what does it return?
Excel Formula:
=LEN(E18)
Its a blank Cell but if we need i can add an space if its needed for the solution

if i put that command on a cell with E18 selected blank option it drops a number "0"
 
Upvote 0
I did some testing, it and it appears that you should be able to use the same logic you already used on your other range:
VBA Code:
Range("E18:E44").ClearContents
 
Upvote 0

Forum statistics

Threads
1,221,418
Messages
6,159,791
Members
451,589
Latest member
Harold14

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