Reset button on Data Validation Lists

excelbrands

New Member
Joined
Jun 25, 2020
Messages
9
Office Version
  1. 365
Platform
  1. Windows
Hello. I have a spreadsheet with cells that have data validation lists and some cells where they can enter anything. I want a reset button that basically wipes out all the info on the cells. I recorded a macro to clear the cells and reset the data validation list, but it did not work on the cells with data validation. Here is a breakdown of what I need.


When they hit the form control button I want this to happen:
cell A9,A28,A46,A66,A87 are data validation lists and I want these set back to "0"
cell B13,B15,B17,B32,B34,B36,B50,B52,B54,B70,B72,B74,B91,B93,B95 are data validation lists and I want these set back to "None"
cell D13,D15,D17,D32,D34,D36,D50,D52,D54,D70,D72,D74,D91,D93,D95 are just cells and I want these just cleared or deleted
cell H13,H15,H17,H32,H34,H36,H50,H52,H54,H70,H72,H74,H91,H93,H95 are just cells and I want these set to "0"

Can you help me with a VB code for this??

The sheet name is called Ramp.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Why not just something like this?

VBA Code:
    With ActiveSheet
        .Range("A9,A28,A46,A66,A87").Value = 0                                               'are data validation lists and I want these set back to "0"
        .Range("B13,B15,B17,B32,B34,B36,B50,B52,B54,B70,B72,B74,B91,B93,B95").Value = "None" 'are data validation lists and I want these set back to "None"
        .Range("D13,D15,D17,D32,D34,D36,D50,D52,D54,D70,D72,D74,D91,D93,D95").ClearContents  'are just cells and I want these just cleared or deleted
        .Range("H13,H15,H17,H32,H34,H36,H50,H52,H54,H70,H72,H74,H91,H93,H95").Value = 0      'are just cells and I want these set to "0"
    End With

If not, you may need to provide a more detailed explanation.
 
Upvote 0
Solution
Appears I may be a couple minutes late but,

How about:

VBA Code:
Sheets("Ramp").Range("A9,A28,A46,A66,A87") = 0                                                  ' data validation lists and I want these set back to "0"
Sheets("Ramp").Range("B13,B15,B17,B32,B34,B36,B50,B52,B54,B70,B72,B74,B91,B93,B95") = "None"    ' data validation lists and I want these set back to "None"
Sheets("Ramp").Range("D13,D15,D17,D32,D34,D36,D50,D52,D54,D70,D72,D74,D91,D93,D95") = ""        ' just cells and I want these just cleared or deleted
Sheets("Ramp").Range("H13,H15,H17,H32,H34,H36,H50,H52,H54,H70,H72,H74,H91,H93,H95") = 0         ' just cells and I want these set to "0"
 
Upvote 0
Why not just something like this?

VBA Code:
    With ActiveSheet
        .Range("A9,A28,A46,A66,A87").Value = 0                                               'are data validation lists and I want these set back to "0"
        .Range("B13,B15,B17,B32,B34,B36,B50,B52,B54,B70,B72,B74,B91,B93,B95").Value = "None" 'are data validation lists and I want these set back to "None"
        .Range("D13,D15,D17,D32,D34,D36,D50,D52,D54,D70,D72,D74,D91,D93,D95").ClearContents  'are just cells and I want these just cleared or deleted
        .Range("H13,H15,H17,H32,H34,H36,H50,H52,H54,H70,H72,H74,H91,H93,H95").Value = 0      'are just cells and I want these set to "0"
    End With

If not, you may need to provide a more detailed explanation.
Thank you so much!!!
 
Upvote 0
Appears I may be a couple minutes late but,

How about:

VBA Code:
Sheets("Ramp").Range("A9,A28,A46,A66,A87") = 0                                                  ' data validation lists and I want these set back to "0"
Sheets("Ramp").Range("B13,B15,B17,B32,B34,B36,B50,B52,B54,B70,B72,B74,B91,B93,B95") = "None"    ' data validation lists and I want these set back to "None"
Sheets("Ramp").Range("D13,D15,D17,D32,D34,D36,D50,D52,D54,D70,D72,D74,D91,D93,D95") = ""        ' just cells and I want these just cleared or deleted
Sheets("Ramp").Range("H13,H15,H17,H32,H34,H36,H50,H52,H54,H70,H72,H74,H91,H93,H95") = 0         ' just cells and I want these set to "0"
Thank you so much!!
 
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,525
Members
449,088
Latest member
RandomExceller01

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