Debra,
I've tried to embellish your idea.. by grouping similar validation
I only tested it on 1 'nasty' book and it worked ok, but no doubt
it will have some flaws in real life. apart from not handling
Specialcells max area count
Wouldnt mind some comments
Option Explicit
Sub DVDocumenter()
Dim wkb As Workbook
Dim wks As Worksheet
Dim rngAll As Range
Dim rngCel As Range
Dim rngSame As Range
Dim rngDone As Range
Dim wksLOG As Worksheet
Dim lngCalc As Long
Application.ScreenUpdating = False
Application.EnableEvents = False
lngCalc = Application.Calculation
Application.Calculation = xlCalculationManual
On Error Resume Next
Set wkb = ActiveWorkbook
Set wksLOG = Workbooks.Add(xlWBATWorksheet).Worksheets(1)
wksLOG.Range("a1:n1") = Array("Addr", _
"Type", "IgnoreBlank", "InCellDropdown", _
"Formula1", "Operator", "Formula2", _
"ShowInput", "InputTitle", "InputMessage", _
"AlertStyle", "ShowError", "ErrorTitle", "ErrorMessage")
For Each wks In wkb.Worksheets
If wks.ProtectContents Then
wksLOG.Cells(Rows.Count, 1).End(xlUp)(2, 1) = wks.Name & _
" skipped: protected!"
Else
Set rngAll = Nothing
Set rngAll = wks.Cells.SpecialCells(xlCellTypeAllValidation)
If Not rngAll Is Nothing Then
Debug.Print " " & rngAll.Count
Set rngDone = wks.Cells(Rows.Count, Columns.Count)
For Each rngCel In rngAll
If Intersect(rngCel, rngDone) Is Nothing Then
Set rngSame = rngCel.SpecialCells(xlCellTypeSameValidation)
Call DumpDV(rngSame, wksLOG)
If rngDone.Count + rngSame.Count >= rngAll.Count Then
Exit For
Else
Set rngDone = Union(rngDone, rngSame)
End If
End If
Next
End If
End If
Next
wksLOG.UsedRange.WrapText = False
wksLOG.UsedRange.EntireColumn.AutoFit
wksLOG.UsedRange.EntireRow.AutoFit
wksLOG.Range("a:a,e:e,j:j,n:n").WrapText = True
Application.ScreenUpdating = True
Application.EnableEvents = True
Application.Calculation = lngCalc
End Sub
Sub DumpDV(rng As Range, wks As Worksheet)
Dim dv As Validation
Dim rngA As Range
Dim sAddr As String
Set dv = rng.Cells(1).Validation
sAddr = rng.Worksheet.Name & vbLf
For Each rngA In rng.Areas
sAddr = sAddr & rngA.Address & vbLf
Next
sAddr = Left(sAddr, Len(sAddr) - 1)
With wks.Cells(Rows.Count, 1).End(xlUp)(2, 1).Resize(1, 14)
.NumberFormat = "@"
.Value = Array(sAddr, _
dv.Type, dv.IgnoreBlank, dv.InCellDropdown, _
dv.Formula1, dv.Operator, dv.Formula2, _
dv.ShowInput, dv.InputTitle, dv.InputMessage, _
dv.AlertStyle, dv.ShowError, dv.ErrorTitle, dv.ErrorMessage)
End With
End Sub
--
keepITcool
|
www.XLsupport.com | keepITcool chello nl | amsterdam
Debra Dalgleish wrote :