Sub SopprFormatNonUsati()
SupprFormats True
End Sub
Sub SopprFormatCelleVuote()
SupprFormats False
End Sub
Private Sub SupprFormats(Min As Boolean)
Dim Form As String, Prev As String, F As Str in g
Dim I As Integer, J As Integer
Dim dObj As New DataObject, C As New Collect io n
Dim Wksht As Worksheet, Cell As Range, Shts As Sheet s
Application.EnableCancelKey = xlDisabled
Application.StatusBar = "Lista i formati... "
Do
J = (J + 1) Mod 5
If J = 0 Then I = I + 1
Application.SendKeys "{TAB}{END}{TAB 2}{HO ME }" & I If(I, "{PGDN " _
& I & "}", "") & IIf(J, "{DOWN " & J & " }" , "") & "+{TAB}^c{ESC}"
Application.Dialogs(xlDialogFormatNumber). Sh ow
dObj.GetFromClipboard
Form = dObj.GetText(1)
If Form = Prev Then Exit Do
C.Add Form, Form
Prev = Form
Loop
Application.StatusBar = "Search of the formats being..."
Set Shts = ActiveWindow.SelectedSheets
On Error Resume Next
For Each Wksht In Worksheets
Wksht.Select
For Each Cell In Wksht.UsedRange
If Not IsEmpty(Cell) Or Min Then
F = C.Item(Cell.NumberFormatLocal)
If F <> "" Then
C.Remove Cell.NumberFormatLocal
F = ""
End If
End If
Next Cell
Next Wksht
Application.ScreenUpdating = False
Err.Clear
Application.StatusBar = False
J = 0
With ActiveWorkbook
Workbooks.Add
For I = 1 To C.Count
Range("A1").NumberFormatLocal = C(I)
.DeleteNumberFormat ActiveCell.NumberFor ma t
If Err = 0 Then J = J + 1 Else Err.Clear
Next I
MsgBox J & " The formats used are not suppressed. ", vbInformation
End With
ActiveWorkbook.Close False
Shts.Select
End Sub