PDA

View Full Version : [SOLVED:] Reset data validation drop-down list via VBA linked button



bglumac
10-18-2016, 03:47 AM
I'm trying to make reset button to work but my problem is that on every code I tried button can't get the range from selection.

Basically what I need is to reset the values of validation type combo boxes upon selection, all via button.
So I want to select a part of the table and reset it.
Code I'm using is:

Private Sub Selection_Click()
Selection.Value = "-"
End Sub
When I enter fixed selection it works fine, but when I tried to range what is selected it's not working.

Private Sub Header_click()
Dim cl As Range
For Each cl In Range("header")
cl = "-"
Next cl
End Sub

It's linked to the button, but it's not working (it's on active worksheet).
Do I need to dim or set another range ?
For now, I select it and the Run-time error '13' ... Type mismatch is triggered, yellowing next line upon debuging.

Selection.Value = "-"
THX

mana
10-18-2016, 04:10 AM
please try this.

activecell.value="-"

bglumac
10-18-2016, 04:18 AM
Great, it works !!!

THX mana :)

mana
10-18-2016, 04:21 AM
I'm sorry, I misunderstood.

bglumac
10-18-2016, 04:26 AM
You did GREAT !!!
Simple but effective :)