+ Reply to Thread
Results 1 to 4 of 4

VBA Code help for clearing multiple cells on all worksheets but three

  1. #1
    Registered User
    Join Date
    10-02-2014
    Location
    Ontario, Canada
    MS-Off Ver
    2010
    Posts
    7

    VBA Code help for clearing multiple cells on all worksheets but three

    Hi all,

    Complete beginner at VBA code, trying to make a code that can clear contents of certain cells on all worksheets except three. Can someone help me with my code:

    Sub Clear()

    Dim i As Long
    Sheet1.Select
    Range("F30:F31").Select
    Selection.ClearContents
    Range("I35").Select
    Selection.ClearContents
    Range("I37").Select
    Selection.ClearContents
    Range("D49:D55").Select
    Selection.ClearContents
    For i = 2 To ThisWorkbook.Sheets.Count
    If Sheets(i).Name <> "HOURS" Or_
    If Sheets(i).Name <> "MASTER" Or_
    If Sheets(i).Name <> "Summary" Then Sheets(i).Select Replace:=False
    Next i

    End Sub

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: VBA Code help for clearing multiple cells on all worksheets but three

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-02-2014
    Location
    Ontario, Canada
    MS-Off Ver
    2010
    Posts
    7

    Re: VBA Code help for clearing multiple cells on all worksheets but three

    Hey, Thanks! Seems to have worked.

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: VBA Code help for clearing multiple cells on all worksheets but three

    You're welcome. Glad to help out and thanks for the feedback. Please comply with Forum Rules and mark this thread as solved.

    http://www.excelforum.com/forum-rule...rum-rules.html

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Trying to finish a VBA code to copy cells from multiple workbooks and worksheets
    By sweetnasty in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-10-2014, 11:56 PM
  2. [SOLVED] run-time error 13 with code - Clearing Contents of cells
    By Chardo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-18-2014, 03:23 AM
  3. [SOLVED] Help with Code - clearing contents of cells
    By sajanpatel15 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-01-2013, 03:17 PM
  4. Help required clearing merged, multiple cells
    By PainZ in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-25-2009, 07:39 AM
  5. Clearing multiple cells in 1 click?
    By Lewis Koh in forum Excel Formulas & Functions
    Replies: 103
    Last Post: 09-06-2005, 07:05 PM

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