Resetting Data Validation

Glaswegian

Well-known Member
Joined
Oct 14, 2003
Messages
1,487
My spreadsheet contains a number of cells where I've used data validation to present users with a choice of 4 options - they simply pick a letter and that is then printed when they eventually print the sheet. The cells will remain blank if not selected - this is dependent on the customer type etc. The workbook will be saved under a customer ref, so the validation cells will remain as originally chosen.

However, the next time the user opens the blank workbook(not the one saved with the customer ref) the validation cells should be blank/reset. Is it possible to do this?
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Couldn't you save your blank workbook as a Template? When the user opens it (Using File|New) Excel will create a copy so that the original is not overwritten.
 
Upvote 0
Hi Andrew

I guess that is a possibility, although the users are a pretty diverse bunch, with many only having very basic PC skills. In some cases they'll be doing well if they can open and save the original file.
 
Upvote 0
I'm not sure this is the best answer available, but this is how I solved a problem similiar to yours.

I recorded a macro called "answers_reset". What is did was blank all the answers to the selected answers and replace them with the answer "Answer Reset".

In this way the person opening the sheet would see all the questions to be chosen set at "answers reset". They then can choose their answer from the data validation choices. It also helps in that I can automatically tell if they have left a particular answer blank. Hope this helps. J.Dee
 
Upvote 0
Hi jdee

Thanks for your suggestion. I tried the following on workbook close

Worksheets("DFAS").Range("B16:B34").ClearContents.

This cleared the cells OK. Unfortunately, when I re-opened the saved workbook, the cells had indeed been cleared - but I really need to have the selections 'permanent' within the saved workbook. The code is fine for when the user re-opens the blank workbook.

Is it possible to ensure that the selections remain in place in the saved version but are cleared when the blank version is opened?
 
Upvote 0
What's the name of the blank workbook? You could clear the cells when it's opened (instead of when it's closed), eg:

Code:
Private Sub Workbook_Open()
   If ThisWorkbook.Name = "Blank.xls" Then
      Worksheets("DFAS").Range("B16:B34").ClearContents
   End If
End Sub
 
Upvote 0
Thanks Andrew

If I'd stopped to think then that solution would have been obvious!!

Cheers. :oops:
 
Upvote 0

Forum statistics

Threads
1,214,904
Messages
6,122,169
Members
449,070
Latest member
webster33

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