![]() |
Data validation question
I hve a lot of validation on a sheet, I know that you can highlight invalid
cells by using Tools | Auditing | Show Auditing Toolbar | Circle Invalid Data This is very useful but I wondered if it was possible to count the number of invalid cells and display in a message box as my sheet may contain several hundred rows. Thanks in advace. Gareth |
Data validation question
The following macro counts the data validation cells with errors:
Sub CountDVErrors() Dim rngDV As Range Dim c As Range Dim countDV As Long Dim ws As Worksheet Set ws = ActiveSheet On Error GoTo errHandler Set rngDV = ws.Cells.SpecialCells(xlCellTypeAllValidation) On Error GoTo 0 countDV = 0 For Each c In rngDV If Not c.Validation.Value Then countDV = countDV + 1 End If Next MsgBox "There are " & countDV & " DV cells with errors" Exit Sub errHandler: MsgBox "No cells with data validation on the active sheet." End Sub Gareth wrote: I hve a lot of validation on a sheet, I know that you can highlight invalid cells by using Tools | Auditing | Show Auditing Toolbar | Circle Invalid Data This is very useful but I wondered if it was possible to count the number of invalid cells and display in a message box as my sheet may contain several hundred rows. Thanks in advace. Gareth -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html |
All times are GMT +1. The time now is 05:42 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com