Multiple Validation Lists in worksheet (wk1). Validation list needs to pull data from another worksheet (wk2) - which houses 5+ columns/variables. Access db, etc not an option. Need to query wk2 with 1+ parameters/variables. Found articles on MS Query and on Validation lists, but none linking the two together.
MS Query:
Code for Validation list (Market needs to be an array variable - maybe passed though another function?):
Much Thanks, -Thoeum
Sub MarketValidate()
Dim xl As Object
Dim wkb As Workbook
Dim CUR As Worksheet
Dim DVR As Worksheet
Dim Market As String
Dim Region As String
Set xl = CreateObject("excel.application")
Set wkb = ThisWorkbook
Set CUR = wkb.Worksheets("MISTER Upload Request")
Set DVR = wkb.Worksheets("DataValuesR")
Region = "B9"
Market = "1. Choice1, 2. Choice2, 3. Choice3"
CUR.Range("B10").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, _
AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:=Market
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End Sub
MS Query:
Code for Validation list (Market needs to be an array variable - maybe passed though another function?):
Much Thanks, -Thoeum
Sub MarketValidate()
Dim xl As Object
Dim wkb As Workbook
Dim CUR As Worksheet
Dim DVR As Worksheet
Dim Market As String
Dim Region As String
Set xl = CreateObject("excel.application")
Set wkb = ThisWorkbook
Set CUR = wkb.Worksheets("MISTER Upload Request")
Set DVR = wkb.Worksheets("DataValuesR")
Region = "B9"
Market = "1. Choice1, 2. Choice2, 3. Choice3"
CUR.Range("B10").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, _
AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:=Market
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End Sub