+ Reply to Thread
Results 1 to 2 of 2

How can I document the Data Validation used in a worksheet?

  1. #1
    New VA User
    Guest

    How can I document the Data Validation used in a worksheet?

    I'm trying to document a worksheet. Is there a way to save all the data
    validation parameters to a file other than cutting & pasting each entry?

  2. #2
    JE McGimpsey
    Guest

    Re: How can I document the Data Validation used in a worksheet?

    This might be a start. It saves the type and formula parameters of the
    validation object in the cells in the active sheet which contain
    validation. It doesn't save input strings or error strings, though those
    could be added:

    Public Sub DocumentValidation()
    Dim sVal As Variant
    Dim rValidation As Range
    Dim rCell As Range
    Dim nFile As Long
    Dim sC As String
    sC = Chr(9)
    On Error Resume Next
    Set rValidation = Cells.SpecialCells(xlCellTypeAllValidation)
    If Not rValidation Is Nothing Then
    nFile = FreeFile
    Open "test.txt" For Output As #nFile
    For Each rCell In rValidation
    ReDim sVal(0 To 3)
    With rCell.Validation
    sVal(0) = Choose(.Type + 1, "Input Only", _
    "Whole Number", "Decimal", "List", "Date", _
    "Time", "Text Length", "Custom")
    sVal(1) = .Formula1
    sVal(2) = Choose(.Operator, "And", "Or", "Top 10", _
    "Bottom 10", "Top 10%", "Bottom 10%")
    sVal(3) = .Formula2
    End With
    Print #nFile, rCell.Address(False, False) & sC & _
    sVal(0) & sC & sVal(1) & sC & sVal(2) & _
    sC & sVal(3)
    sVal = Empty
    Next rCell
    Close #nFile
    On Error GoTo 0
    End If
    End Sub

    If you're new to macros, check out David McRitchie's "Getting Started
    with Macros" web page:

    http://www.mvps.org/dmcritchie/excel/getstarted.htm

    In article <[email protected]>,
    "New VA User" <New VA [email protected]> wrote:

    > I'm trying to document a worksheet. Is there a way to save all the data
    > validation parameters to a file other than cutting & pasting each entry?


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1