Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 46
Default Code to find data validation in a cell

I'm trying to gin up the code to determine if a cell in a worksheet
validates data from a list and if yes, what list is in use. What I
have so far is:

sub Find_Val()
dim rCell as range

For Each rCell In ActiveSheet.UsedRange
If rCell.Validation.Type = xlValidateList Then MsgBox
rCell.Validation.Formula1
Next rCell

end sub

This generates an error. Can anyone suggest valide code to do this?

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 46
Default Code to find data validation in a cell

Futzed with it some more, and this code will do it:

Sub Find_Validation()
Dim rCell As Range
On Error Resume Next
For Each rCell In ActiveSheet.UsedRange
If rCell.Validation.Type = xlValidateList _
Then MsgBox rCell.Validation.Formula1

Next rCell

End Sub

.... but is there a more direct or "elegant" way? The On Error Resume
Next seems like a cheap fix.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Validation Data using Validation Table cell range..... Dermot Excel Discussion (Misc queries) 16 January 5th 10 09:35 PM
Why does data validation not work when pasting data into a cell. rjshelby Excel Discussion (Misc queries) 1 July 31st 06 09:08 PM
Excel: Find/Replace for Data Validation text or Worksheet Objects [email protected] Excel Discussion (Misc queries) 3 May 22nd 06 07:16 PM
Data Validation / find & replace Penny Excel Discussion (Misc queries) 1 July 20th 05 08:45 PM
Find the cell value in excel by using vb code Michael Excel Discussion (Misc queries) 5 June 14th 05 01:24 PM


All times are GMT +1. The time now is 11:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"