Results 1 to 18 of 18

Thread: [Solved] Macro Looking for Blank cell or Cell with space(s) & deleting it

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    May 2010
    Posts
    33

    Resolved [Solved] Macro Looking for Blank cell or Cell with space(s) & deleting it

    hello everyone,

    I am stuck on a problem, I want a macro that will look for a cell that has a space or more within and then deletes that cell automatically.
    However the Excel sheet is relatively big and thus I do not want to go through the sheet cell by cell.. (My computer / Excel does not seem to manage it..)

    I have also tried this, but that did not seem to work at all.. all cells with spaces were still there.

    Code:
    Sub clear()
        Dim c As Range
        For Each c In Range("A1:Z2000")
            If c = " " Then Range("A" & c.Row & ":A" & c.Row).ClearContents
        Next c
        For Each c In Range("A1:Z2000")
            If c = "  " Then Range("A" & c.Row & ":A" & c.Row).ClearContents
        Next c
        For Each c In Range("A1:Z2000")
            If c = "   " Then Range("A" & c.Row & ":A" & c.Row).ClearContents
        Next c
    End Sub
    ** This is not my code, it was copied from the internet (slightly modified)

    Thanks for the help in advance!
    Last edited by Fr0mi; Aug 3rd, 2010 at 04:36 AM. Reason: solved

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width