Avatar of Cook09
Cook09Flag for United States of America

asked on 

Excel Data Validation VBA Expand from 1 Col to 2 Cols

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
VBAMicrosoft Excel

Avatar of undefined
Last Comment
Cook09
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Please describe what should happen that isn't happening now.
ASKER CERTIFIED SOLUTION
Avatar of Saqib Husain
Saqib Husain
Flag of Pakistan image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Cook09
Cook09
Flag of United States of America image

ASKER

Syed,
Yes this code works as needed...Thanks.  Question though...what causes the Target.Count to increment?
Cook09
SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of Cook09
Cook09
Flag of United States of America image

ASKER

Appreciate the "It works first time code"...and for the answer to the follow-up question.
Cook09
Microsoft Excel
Microsoft Excel

Microsoft Excel topics include formulas, formatting, VBA macros and user-defined functions, and everything else related to the spreadsheet user interface, including error messages.

144K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo