Validation list to a Range?

  • Thread starter Thread starter Dr.Ile
  • Start date Start date
D

Dr.Ile

Hello,

I'm wondering how to add a Validation List to a Range. I'm trying this

For i=1 to 5
Cells(i,1).Validation.Add Type:=xlValidateList
Formula1:="=$D$1:$D$10"
next i

but it's not working. Can you help me out
_Is_it_possible_without_looping?_

Thank you in advance
Regards

Dr.il
 
Sub tester()
Range("A1:A5").Validation.Add Type:=xlValidateList, _
Formula1:="=$D$1:$D$10"
End Sub

HTH
 
Thank you Ardus, but I'm not satisfied with solution.
I'm trying with this but it's not working (I need n for looping):

Dim n As Integer
n = 10
Range(Cells(1, 1), Cells(n, 1)).Validation.Add Type:=xlValidateList, _
Formula1:="=$D$1:$D$10"

Regards

Dr.il
 
Your code is syntactically correct, and runs without any problem.

Could you post the surrounding code, so that I can understand what you
intend to do?

HTH
 

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

Back
Top