+ Reply to Thread
Results 1 to 3 of 3

Run macro on all sheets except 1

Hybrid View

  1. #1
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Run macro on all sheets except 1

    Hello everyone
    I want to run macro Hide rows if the workbook name is not 1 i.e. to run the macro on all sheets except the sheet names "1"
    For this I am doing this--
    But this is running on The sheet named as "1" too....
    Can someone please Help....

    Sub Apply_to_all_sheets()
           
    Dim ws As Worksheet
    For Each ws In ThisWorkbook.Worksheets
       With ws
          If .Name <> "1" Then
            Call HideRows
                 End If
       End With
    Next ws
    End Sub
    Sub HideRows()
        Dim cell As Range
        For Each cell In Range("BA3:BA22")
            If Not IsEmpty(cell) Then
                If cell.Value = 1 Then
                    cell.EntireRow.Hidden = True
                End If
            End If
        Next
    End Sub
    Attached Files Attached Files
    Last edited by sourabhg98; 01-21-2015 at 10:10 AM.

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Run

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution.

    Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.

    To change a Title go to your first post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: Run

    I am sorry but selected the whole option from the drop down list....but I dont know why it changed it to just Run

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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