Results 1 to 5 of 5

Thread: Run Macro on multiple worksheets within an excel file

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2013
    Posts
    2

    Run Macro on multiple worksheets within an excel file

    Hello,

    I am trying to create a macro to run on all worksheets within a tab. So far it is only running on one worksheet and it does not work on other. Can someone please assist me. Below is the code I used. Thank you

    Code:
    Dim ws As Worksheet
    For Each ws In ActiveWorkbook.Worksheets
    If ws.Name <> "Sheet1" Or ws.Name <> "Sheet2" Then
    Columns("F:H").Select
    Range("H1").Activate
    Selection.EntireColumn.Hidden = True
    End If
    
    Next ws.Activate
    End Sub
    Last edited by Siddharth Rout; Apr 27th, 2013 at 01:17 PM. Reason: Added Code Tages

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