Macros in different sheets

Erantes

New Member
Joined
Dec 27, 2023
Messages
28
Office Version
  1. 365
Platform
  1. Windows
Hi I am fairly new to excel with a problem I cant solve so help would be great. I have 10 sheets with a macro on each sheet that I want to trigger at the same time. I have looked at loads of YouTube videos but whatever I do it only seems to trigger on the sheet I'm on and none of the other sheets.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
How do you want to "trigger" them? Do they all do the same thing, just on a different Sheet?
 
Upvote 0
You haven't answered @Skyybot 's question as to how you want to Trigger the code?
Hi so each macro is to collect information at a certain time on each sheet say 8am. I would like to run one macro that would activate the 10 macros at roughly the same time.
 
Upvote 0
Just call the other Macros from the one you run. Example:
VBA Code:
Sub Sheet1Macro() 'This is in Sheet1
'Do stuff
End Sub

Sub Sheet2Macro() 'This is in Sheet2
'Do stuff
End Sub

Sub YourMainMacro() 'Put this in ThisWorkbook
Sheet1.Sheet1Macro
Sheet2.Sheet2Macro
End Sub
 
Upvote 0
Can you post the macro you currently have on "each sheet"? Only once if they're the same.
 
Upvote 0
Sub RACE1TIME0730()
'
' RACE1TIME0730 Macro
'

'
Range("K9").Select
ActiveCell.FormulaR1C1 = "1000"
Range("K9:K48").Select
Selection.Copy
ActiveWindow.SmallScroll Down:=28
Range("K53").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=-28
Range("C2").Select
Application.CutCopyMode = False
Selection.Copy
ActiveWindow.SmallScroll Down:=39
Range("C53").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
Sub RACE2TIME0730()
'
' RACE2TIME0730 Macro
'

'
Range("K9").Select
ActiveCell.FormulaR1C1 = "6.4"
Range("K9").Select
ActiveCell.FormulaR1C1 = "6.4"
Range("K9:K48").Select
Selection.Copy
ActiveWindow.SmallScroll Down:=19
Range("K53").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=-19
Range("C2").Select
Application.CutCopyMode = False
Selection.Copy
ActiveWindow.SmallScroll Down:=34
Range("C53").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
Sub RACE3TIME0730()
'
' RACE3TIME0730 Macro
'

'
Range("K9").Select
ActiveCell.FormulaR1C1 = "2"
Range("K9").Select
ActiveCell.FormulaR1C1 = "2"
Range("K9").Select
ActiveCell.FormulaR1C1 = "2"
Range("K9:K48").Select
Selection.Copy
Range("AF1").Select
ActiveWindow.SmallScroll Down:=28
Range("K53").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=-28
Range("C2").Select
Application.CutCopyMode = False
Selection.Copy
ActiveWindow.SmallScroll Down:=28
Range("C53").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
End Sub
 
Upvote 0
You'll want to refrain from ActiveWindow, ActiveSheet, ActiveCell when you are trying to run code on multiple sheets.
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,684
Members
449,116
Latest member
HypnoFant

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top