Reference varialble value rather than variable name

G

Guest

I'm trying to change the list in a data validation box with the following,
but instead of a list range in the dropdown box, I get the name of the
variable, "ShingleList" , that contains the list. Can anyone suggest a way
around it?

Dim ShingleList As String
ShingleList = "B52:B55"
Range("InptShingleType").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="ShingleList"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With
 
B

Bob Phillips

Dim ShingleList As String
ShingleList = "B52:B55"
Range("InptShingleType").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=
_
xlBetween, Formula1:="=ShingleList"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = True
.ShowError = True
End With


--

HTH

RP
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top