+ Reply to Thread
Results 1 to 7 of 7

Macro to Change Cell Background Color From White to No Fill

Hybrid View

  1. #1
    Registered User
    Join Date
    01-06-2009
    Location
    NYC
    MS-Off Ver
    Excel 2003
    Posts
    4
    Thank you! That works but it takes a very long time per worksheet.

    [EDIT] Trying the second one, thanks.

  2. #2
    Registered User
    Join Date
    01-06-2009
    Location
    NYC
    MS-Off Ver
    Excel 2003
    Posts
    4
    Thanks, the second one seems to work but how do I get it to cycle through each sheet in the workbook? Here is what I have:

    Sub White2Blank()
    Dim Ws As Worksheet
    
    For Each Ws In Worksheets
        Cells.Select
        Application.FindFormat.Clear
        Application.FindFormat.Interior.ColorIndex = 2
        Application.ReplaceFormat.Clear
        Application.ReplaceFormat.Interior.ColorIndex = xlNone
        Selection.Replace What:="", Replacement:="", LookAt:=xlPart, SearchOrder _
            :=xlByRows, MatchCase:=False, SearchFormat:=True, ReplaceFormat:=True
    Next Ws
    End Sub
    Last edited by emcdemc; 01-06-2009 at 08:49 PM.

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    You were close. You can't select the cells without selecting the worksheet, but there's no need to do either.
    Sub White2Blank()
        Dim wks     As Worksheet
    
        With Application
            .FindFormat.Clear
            .FindFormat.Interior.ColorIndex = 2
            .ReplaceFormat.Clear
            .ReplaceFormat.Interior.ColorIndex = xlNone
        End With
    
        For Each wks In Worksheets
            wks.Cells.Replace What:="", Replacement:="", _
                              LookAt:=xlWhole, MatchCase:=True, _
                              SearchFormat:=True, ReplaceFormat:=True
        Next wks
    End Sub
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    01-06-2009
    Location
    NYC
    MS-Off Ver
    Excel 2003
    Posts
    4
    Perfect thank you!

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    You’re welcome. Would you please mark the thread as Solved?

    Click the Edit button on your first post in the thread

    Click Go Advanced, select [SOLVED] from the Prefix dropdown, then click Save Changes

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1