ich habe unten stehenden Code für das glätten von Tabellenblätter gefunden. der funktioniert auch wunderbar. Ich würde allerdings alle Tabellenblätter glätten außer ein bestimmtes.
Bei dem Makro unten werden automatisch alle Tabellenblätter geglättet.
Vielleicht ginge das mit einer Funktion, die den Befehl "es passiert nichts" gibt bei einem bestimmten Tabellenblatt, und sonst "Call trimCells()". Bin aber nicht so weit gekommen.
Grüße
Iris
Sub TrimCells()
Dim objSh As Worksheet
Dim rng As Range, rngR As Range
Dim lngCalc As Long
On Error GoTo ErrExit
With Application
.EnableEvents = False
.ScreenUpdating = False
lngCalc = .Calculation
.Calculation = xlCalculationManual
End With
For Each objSh In ThisWorkbook.Worksheets
On Error Resume Next
Set rngR = objSh.UsedRange.SpecialCells(xlCellTypeConstants)
Err.Clear
On Error GoTo ErrExit
If Not rngR Is Nothing Then
For Each rng In rngR
rng = Trim(rng)
Next
End If
Next
ErrExit:
With Application
.EnableEvents = True
.ScreenUpdating = True
.Calculation = lngCalc
End With
Set rng = Nothing
Set rngR = Nothing
Set objSh = Nothing
End Sub