We help IT Professionals succeed at work.

Excel Data Validation VBA Expand from 1 Col to 2 Cols

Cook09
Cook09 asked
on
148 Views
Last Modified: 2017-04-25
Attached is a workbook where the code works in setting Data Validation for a particular cell. The DV cell only has the missing List Items. In its current form the vba works very well...no complaints.
I would like to expand the code to include one of two Columns, depending upon the ActiveCell.  If the Active Cell is in Col "C" then the code runs.  If the Target is Col "G" then set the DV for that cell.  Both Columns would have Select* in the cell(s) where the DV should be placed. The current code has the Range hard coded. Prefer a more flexible method.

Cook09
DV-Weekdays-1Col.xlsm
Comment
Watch Question

Martin LissSocial distance - Don't touch your face - Wash your hands for 20 seconds
CERTIFIED EXPERT
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
Please describe what should happen that isn't happening now.
Engineer
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Syed,
Yes this code works as needed...Thanks.  Question though...what causes the Target.Count to increment?
Cook09
Martin LissSocial distance - Don't touch your face - Wash your hands for 20 seconds
CERTIFIED EXPERT
Most Valuable Expert 2017
Distinguished Expert 2018
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Appreciate the "It works first time code"...and for the answer to the follow-up question.
Cook09
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.