ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Validation list to a Range? (https://www.excelbanter.com/excel-programming/363778-validation-list-range.html)

Dr.Ile[_15_]

Validation list to a Range?
 

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

--
Dr.Il
-----------------------------------------------------------------------
Dr.Ile's Profile: http://www.excelforum.com/member.php...fo&userid=1597
View this thread: http://www.excelforum.com/showthread.php?threadid=55023


Ardus Petus

Validation list to a Range?
 
Sub tester()
Range("A1:A5").Validation.Add Type:=xlValidateList, _
Formula1:="=$D$1:$D$10"
End Sub

HTH
--
AP

"Dr.Ile" a écrit dans
le message de news: ...

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.ile


--
Dr.Ile
------------------------------------------------------------------------
Dr.Ile's Profile:
http://www.excelforum.com/member.php...o&userid=15975
View this thread: http://www.excelforum.com/showthread...hreadid=550231




Dr.Ile[_16_]

Validation list to a Range?
 

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

--
Dr.Il
-----------------------------------------------------------------------
Dr.Ile's Profile: http://www.excelforum.com/member.php...fo&userid=1597
View this thread: http://www.excelforum.com/showthread.php?threadid=55023


Ardus Petus

Validation list to a Range?
 
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
--
AP

"Dr.Ile" a écrit dans
le message de news: ...

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.ile


--
Dr.Ile
------------------------------------------------------------------------
Dr.Ile's Profile:
http://www.excelforum.com/member.php...o&userid=15975
View this thread: http://www.excelforum.com/showthread...hreadid=550231




Dr.Ile[_17_]

Validation list to a Range?
 

Sorry Ardus, I don't know, but the code is running perfectly:).
Anyway, thanx.

Dr.il

--
Dr.Il
-----------------------------------------------------------------------
Dr.Ile's Profile: http://www.excelforum.com/member.php...fo&userid=1597
View this thread: http://www.excelforum.com/showthread.php?threadid=55023



All times are GMT +1. The time now is 12:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com