![]() |
Check cells for validation list
Validation is associated with individual cells. Do you want the IF to detect
if ANY cell in the range has validation or if ALL the cells in the range have validation applied? -- Gary''s Student - gsnu200796 "Sandy" wrote: Tried to post this earlier but it didn't seem to arrive?? How do I check for validation list in a range Roughly:- If Range("C30:K30,C36:K36") has validation then *****Code****** Else *****Code****** End If Thanks Sandy |
Check cells for validation list
Detecting if any in a range would be good
sandy "Gary''s Student" wrote in message ... Validation is associated with individual cells. Do you want the IF to detect if ANY cell in the range has validation or if ALL the cells in the range have validation applied? -- Gary''s Student - gsnu200796 "Sandy" wrote: Tried to post this earlier but it didn't seem to arrive?? How do I check for validation list in a range Roughly:- If Range("C30:K30,C36:K36") has validation then *****Code****** Else *****Code****** End If Thanks Sandy |
Check cells for validation list
Sub sandy()
' gsnuxx x = 9999 Set r = Range("C30:K30", "C36:K36") For Each rr In r On Error Resume Next x = rr.Validation.Type If x < 9999 Then MsgBox ("validation found in: " & rr.Address) Exit Sub End If Next MsgBox ("No validation found") End Sub This routine examines the range. If no validation is found, a message is issued. If validation is found, the address of the first cell with validation is output in a message. -- Gary''s Student - gsnu200796 "Sandy" wrote: Detecting if any in a range would be good sandy "Gary''s Student" wrote in message ... Validation is associated with individual cells. Do you want the IF to detect if ANY cell in the range has validation or if ALL the cells in the range have validation applied? -- Gary''s Student - gsnu200796 "Sandy" wrote: Tried to post this earlier but it didn't seem to arrive?? How do I check for validation list in a range Roughly:- If Range("C30:K30,C36:K36") has validation then *****Code****** Else *****Code****** End If Thanks Sandy |
Check cells for validation list
You are welcome.
Another approach is to create a range of validation cells using SpecialCells and see if it intersects with the range of interest. -- Gary''s Student - gsnu200796 "Sandy" wrote: Gary''s Student Thank you very much Sandy "Gary''s Student" wrote in message ... Sub sandy() ' gsnuxx x = 9999 Set r = Range("C30:K30", "C36:K36") For Each rr In r On Error Resume Next x = rr.Validation.Type If x < 9999 Then MsgBox ("validation found in: " & rr.Address) Exit Sub End If Next MsgBox ("No validation found") End Sub This routine examines the range. If no validation is found, a message is issued. If validation is found, the address of the first cell with validation is output in a message. -- Gary''s Student - gsnu200796 "Sandy" wrote: Detecting if any in a range would be good sandy "Gary''s Student" wrote in message ... Validation is associated with individual cells. Do you want the IF to detect if ANY cell in the range has validation or if ALL the cells in the range have validation applied? -- Gary''s Student - gsnu200796 "Sandy" wrote: Tried to post this earlier but it didn't seem to arrive?? How do I check for validation list in a range Roughly:- If Range("C30:K30,C36:K36") has validation then *****Code****** Else *****Code****** End If Thanks Sandy |
All times are GMT +1. The time now is 11:14 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com