![]() |
Run Macro on multiple worksheets
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 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 |
Run Macro on multiple worksheets
Hi,
Am Sat, 27 Apr 2013 15:21:40 +0100 schrieb biyi11: 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 try: Sub Test() Dim ws As Worksheet For Each ws In ActiveWorkbook.Worksheets If ws.Name < "Sheet1" And ws.Name < "Sheet2" Then ws.Columns("F:H").Hidden = True End If Next End Sub Regards Claus Busch -- Win XP PRof SP2 / Vista Ultimate SP2 Office 2003 SP2 /2007 Ultimate SP2 |
All times are GMT +1. The time now is 09:06 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com