View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Billy Liddel Billy Liddel is offline
external usenet poster
 
Posts: 527
Default Obtain the Range Name used for Data Validation



"Robert" wrote:

I need to aquire the name of the range that was used in Data Validation
programatically at runtime.

Many Thanks
--
Robert Hill


Robert

Insert this code in the workbook module (right-click the Excel icon on the
on the file menu) and choose View Code.

Sub workbook_open()
Dim i As Integer, x
On Error Resume Next
Application.ScreenUpdating = False
For i = 1 To Worksheets.Count
Worksheets(i).Select
x = ActiveCell.SpecialCells(xlCellTypeAllValidation).S elect
If IsEmpty(x) Then
' Do nothing
Else
MsgBox Selection.Address & vbLf & ActiveSheet.Name
End If
Next i
Worksheets(1).Select
Application.ScreenUpdating = False
End Sub

Tweak to suit

regards
Peter