VBA - Update Data Validation list if checkbox is checked/unchecked

Daniel_72

New Member
Joined
Jun 26, 2017
Messages
26
Hi All,

Here is a tough question/problem I need help with:

I have one sheet (“DataVal”) with a lot of possible alternative for the user:

For example, in column A10:A16 I have mon, Tue, Wed, Thu, Fri, Sat and Sun with checkboxes linked to each cell. The idea Is that, if the checkbox for example mon, wed, sat is checked, it will update the data validation list that is in sheet MasterData in column E from row nr 16 and down to row 1000.

Later on, the Admin-user might want to uncheck or check new alternative in the checkbox list (sheet “DataVal”), and I want the data validation list in sheet “MasterData” E16:E1000 to reflect the changes.

I can’t use the list A10:A16 in sheet “DataVal” as a list for data validation because all alternative should not be possible for all different departments. Also, I don’t want any blanks alternative in the data validation list in sheet MasterData E16:E1000.

Does anyone have any suggestion, I have tried a lot of different solutions but I can’t get I to work as I want? Maybe some VBA Code would the trick……..

Thanks in advance

Daniel
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
If Mon and Tue are ticked in DateVal .... does the DV list in MasterData become Mon, Tue ?
If Mon, Thu and Sun are ticked in DateVal .... does the DV list in MasterData become Mon, Thu, Sun ?
etc

Cells E16:E1000 in MasterData may already contain values when a different combination of days is ticked in DateVal
- some historic values may no longer meet the new DV criteria
- does that matter ?
- if so ... what should happen to those values
 
Upvote 0
If Mon and Tue are ticked in DateVal .... does the DV list in MasterData become Mon, Tue ?
If Mon, Thu and Sun are ticked in DateVal .... does the DV list in MasterData become Mon, Thu, Sun ?
etc

Cells E16:E1000 in MasterData may already contain values when a different combination of days is ticked in DateVal
- some historic values may no longer meet the new DV criteria
- does that matter ?
- if so ... what should happen to those values

Hi,
Yes, if for example Tue, Thu, Fri and Sat is ticked in sheet DateVal I would like the DV list of choices to make in MasterData become Tue, Thu, Fri and Sat.
I understand that some historic values may no longer meet the new DV Criteria and that doesn't matter at all, those values are okey to be left in the file and shall not be erased.

The workbook is for delivery planning and recalculate route drives for the driver. The function above is for change of days possible to deliver, and because the file is going to be used in different departments and can change over time, I would like the flexibility of have these options build in, in the file from the start.

Is it possible?


Again thanks in advance

Daniel
 
Upvote 0
1. You can do this by formula
- have a look this video
- try to make it work for you and if you cannot make it work, come back to this thread
- if using Excel 2010 or later use method2 to avoid using array formula
- watch the whole video regardless
- method1 explains some things that are also used in method2

 
Last edited:
Upvote 0
This is similar to the method used in the video, except that it uses a Workings sheet (which can be hidden) and a helper column
- amend to suit your own requirements

Sheet named DateVal
- with 7 checkboxes in A10 to A16 linked to cells A10 to A16 in sheet Workings
DateVal.jpg



Sheet named Workings

Workings.jpg




Data Validation Source
=dRange

Workings - DV.jpg


Named Range dRange RefersTo
=Workings!$E10:INDEX(Workings!$E$10:$E$16,COUNTIF(Workings!$E$10:$E$16,"?*"))
(dRange is a dynamic named range)

Count of cumulative TRUE values (C10 copied down)
=COUNTIF($A$10:A10,TRUE)

List of days without blanks (E10 copied down)
=IFERROR(INDEX(B10:B16,MATCH(ROWS($B$10:B10),C10:C16,0)),"")
(matches first found cumulative count value in range)
 
Upvote 0
This is similar to the method used in the video, except that it uses a Workings sheet (which can be hidden) and a helper column
- amend to suit your own requirements

Sheet named DateVal
- with 7 checkboxes in A10 to A16 linked to cells A10 to A16 in sheet Workings
View attachment 6462


Sheet named Workings

View attachment 6464



Data Validation Source
=dRange

View attachment 6460

Named Range dRange RefersTo
=Workings!$E10:INDEX(Workings!$E$10:$E$16,COUNTIF(Workings!$E$10:$E$16,"?*"))
(dRange is a dynamic named range)

Count of cumulative TRUE values (C10 copied down)
=COUNTIF($A$10:A10,TRUE)

List of days without blanks (E10 copied down)
=IFERROR(INDEX(B10:B16,MATCH(ROWS($B$10:B10),C10:C16,0)),"")
(matches first found cumulative count value in range)

Hi again,

Thanks a lot, it works fine. I had a bit of problem because I use excel 2016 SWE version and had to replace , with ; and had to use swedish name of the functions.
But no it work :)
 
Upvote 0
That is good news - thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,215,756
Messages
6,126,692
Members
449,331
Latest member
smckenzie2016

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