1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
sub MainProcedure
For Each wsh In ActiveWorkbook.Worksheets
For Each cell In wsh.Range("A1:" & LastCol & Lastrow)
FormatCheck (cell)
next cell
next wsh
end sud
Sub FormatCheck(cell As variant)
'Remove space after and before value
If CStr(cell) <> Trim(cell) Then S_ReportError
'Check for each cell if it contains a formula
If cell.HasFormula = True Then
S_ReportError
End If
'Check for each cell if it contains forbiden character
RegexPattern (cell)
If regX > 0 Then
S_ReportError
End If
'Check for each cell if it contains more than 2 decimal
If IsNumeric(cell) Then
If InStr(CStr(cell), ".") > 0 Then
digit = Len(CStr(cell)) - InStr(CStr(cell), ".")
If digit > 4 Then S_ReportError
end if
end if
end sub |
Partager