wie kann ich bitte per VBA in aktivem Arbeitsblatt am Anfang und am Ende die Leerzeichen entfernen.
Es soll an gesamten Arbeitsblatt angewendet werden!
Gruß,
Selma
Option Explicit
Sub Selma()
Dim Bereich, Zelle As Range
Set Bereich = ActiveSheet.UsedRange.Cells
For Each Zelle In Bereich
Zelle.Value = Trim(Zelle.Value)
Next
Set Bereich = Nothing
End Sub
Gruß Matthias
Option Explicit
Sub Selma()
Dim Bereich, Zelle As Range
Application.ScreenUpdating = False
Set Bereich = ActiveSheet.UsedRange.Cells.SpecialCells(xlCellTypeConstants, 23)
For Each Zelle In Bereich
Zelle.Value = Trim(Zelle.Value)
Next
Set Bereich = Nothing
End Sub
So ist sichergestellt das er keine Formeln in Werte ändert.