Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 1
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 3,872
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro for Multiple Worksheets Excel Hates Me Excel Programming 6 July 16th 10 11:43 AM
run macro in multiple worksheets SteveDB1 Excel Programming 9 June 13th 08 04:29 PM
how to make a macro to clear multiple cells from multiple worksheets? [email protected] Excel Worksheet Functions 2 October 18th 07 04:31 PM
MACRO AND MULTIPLE WORKSHEETS Mel Excel Worksheet Functions 8 January 21st 07 03:53 PM
Macro for multiple worksheets Amber[_3_] Excel Programming 3 January 20th 06 09:51 PM


All times are GMT +1. The time now is 11:56 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"