LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default Running Macro Across More Than One Sheet

I want to run the same macro (please see below) across the following
Worksheets:
"Bench", "Brake", "Indicator", "4", "Frame"

When I run this it works on the Worksheet "Bench" but it seems to run 5
times on that sheet without moving to the next sheet.

The code between the @@@@'s runs fine in isolation but I can't get the For
each and Next to work for me

Please can someone give me a steer on how to get the code right so the macro
runs once on each of the 5 specified sheets then stops.

Many thanks

Kewa
-----------------------
Sub Test()

Dim ws As Worksheet
For Each ws In Worksheets(Array("Bench", "Brake", "Indicator", "4",
"Frame"))

@@@@@@@@@@@@@@@@@@@

Columns("A:A").Select
Selection.TextToColumns Destination:=Range("A1"),
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,
Tab:=False, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:="~", FieldInfo:=Array(Array(1, 1), Array(2, 2), Array(3, 2),
Array(4, 9), Array(5, _
9), Array(6, 9), Array(7, 9), Array(8, 9), Array(9, 9), Array(10,
9), Array(11, 9), Array(12 _
, 9), Array(13, 9), Array(14, 9), Array(15, 9), Array(16, 9),
Array(17, 9), Array(18, 1), _
Array(19, 9), Array(20, 2), Array(21, 1), Array(22, 9), Array(23, 9))


Range("G1").Select
Range("G1").FormulaR1C1 = "=IF(RC6<TIME(19,0,0),RC1,RC1&"" +
""&RC2&"" ""&RC3&"" - ""&RC4)"

Set frng = Range("G1:G" & Range("f65536").End(xlUp).Row)
frng.FillDown

@@@@@@@@@@@@@@@@@@@

Next ws

End Sub

 
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
Running Macro at sheet activation gfkbob[_2_] Excel Programming 2 March 12th 07 01:24 PM
How to activate a worksheet when a macro is running in the sheet m BFSWE Excel Programming 6 October 19th 06 02:19 PM
Don't show sheet switches when running macro Ben Excel Programming 4 May 25th 05 02:10 PM
Can you have a macro always running on a sheet waiting for data Sean Excel Programming 5 April 30th 05 01:06 AM
Running Macro on every sheet in Workbook !!! Jako[_65_] Excel Programming 14 August 9th 04 01:06 AM


All times are GMT +1. The time now is 05:35 AM.

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

About Us

"It's about Microsoft Excel"