Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: Help...again. Need a macro to delete all cells without @ sy

  1. #11
    New Member
    Join Date
    Mar 2002
    Location
    California
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hey Al,

    Maybe I am doing something wrong. I copy and pasted your code into the Visual Basic Editor starting with "With ActiveSheet.UsedRange" through to "Next cel"

    Then I tried to run the macro, but I keep getting a default. Am I not supposed to copy and paste all of that into the VBA? Do I need to name the macro or add Sub/ end sub?

  2. #12
    New Member
    Join Date
    Mar 2002
    Posts
    33
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    use the worksheet function method someone posted. then you won't have to mess around with the vb code.

  3. #13
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Yes you do have to put in between Sub and end sub:

    Sub YourMacroName()
    With ActiveSheet.UsedRange
    Set c = .Find("@", LookIn:=xlValues)
    If Not c Is Nothing Then
    firstAddress = c.Address
    Do
    c.Font.ColorIndex = 5
    Set c = .FindNext(c)
    Loop While Not c Is Nothing And c.Address <> firstAddress
    End If
    End With

    For Each cel In ActiveSheet.UsedRange
    If cel.Font.ColorIndex <> 5 Then cel.ClearContents
    Next cel
    End Sub
    Best regards,
    Allan Chara
    http://www.mrspreadsheets.com

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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