• Delete Leading and Trailing spaces (Excel 97)

    Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Delete Leading and Trailing spaces (Excel 97)

    Author
    Topic
    #383626

    Hi All,

    How would I write a macro that will allow me to delete all leading and trailing spaces in all cells in columns A and B?

    Thanks

    Viewing 0 reply threads
    Author
    Replies
    • #654860

      Try this

      Sub TrimCells()
      Dim oCell As Range
      For Each oCell In [A:B].SpecialCells(xlCellTypeConstants, 2)
      oCell = Trim(oCell)
      Next
      End Sub

      Andrew C

    Viewing 0 reply threads
    Reply To: Delete Leading and Trailing spaces (Excel 97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: