Macros and timer

Erantes

New Member
Joined
Dec 27, 2023
Messages
28
Office Version
  1. 365
Platform
  1. Windows
Hi I'm trying to set macros off at certain times on different worksheets. what seems to be happening is when my macro is activated on sheet 1 it activates macros on other sheets as well. What also seems to happen is if I'm on another worksheet at time of activation on sheet 1 it doesn't activate. My aim is to have 11 macros going off at set times on 10 different sheets without them interfering with each other.
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
You'd have to show code that you're using to give anyone much of a clue. For the 'running other macros' thing my guess is that your code doesn't first disable event handling so other events such as Sheet Change are being called. If I alter application settings such as Application.EnableEvents = False then I make sure to use an error handler so that they don't get left that way.

If you post code for people to review, please use code tags (vba button on posting toolbar) and paste your code within those tags.
 
Upvote 0
VBA Code:
Sub RACE1TIME60()
'
' RACE1TIME60 Macro
'

'
    Range("K9:K48").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("HN9").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("C2").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("HP3").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
End Sub

Hi its just a very basic copy and paste macro. This is RACE1TIME60 macro there is another 10 macros on the same worksheet that do the same copy and paste but at different times of the day. I had the 11 macros running of Application on time in sheet 1 but as i said before other sheets seemed to be affected.
 
Upvote 0
If you want it to act on one sheet only then specify the sheet in the code, at the moment the way it is written it will run on whatever sheet is active at the time of running.
 
Upvote 0
If you want it to act on one sheet only then specify the sheet in the code, at the moment the way it is written it will run on whatever sheet is active at the time of running.


Hi Mark thanks for the speedy reply but to explain i have only basic knowledge and everything I've tried hasn't worked so far hence giving this forum a go.
 
Upvote 0
Please post your sheets name for the code that you have posted
 
Upvote 0
The code that you have posted is copying and pasting to the same sheet so why are you quoting multiple sheets?
Try the code below for Sheet called Race1

VBA Code:
Sub RACE1TIME60()
    '
    ' RACE1TIME60 Macro
    '
    With Application
        .ScreenUpdating = False
        .CutCopyMode = False
    End With
   
   
    With Sheets("Race1") ' this line is where you amend the sheet name
   
        .Range("K9:K48").Copy
        .Range("HN9").PasteSpecial xlValues
        Application.CutCopyMode = False
       
        .Range("C2").Copy
        .Range("HP3").PasteSpecial xlValues
   
    End With
   
    With Application
        .CutCopyMode = False
        .ScreenUpdating = True
    End With
   
End Sub
 
Upvote 1
Solution
Hi Mark sorry for taking so long to reply but have tested your code onto sheet 1 and my 9 other sheets and everything is working perfectly, so thankyou so much for your speedy replies and knowledge.
 
Upvote 0
Mark can i ask one other thing please. I go into the editor and press "Run Sub" for each of my macros on sheet 1 to activate them and there are 11 macros altogether. Is there a quicker way to activate (Run) these macros with one command?
 
Upvote 0

Forum statistics

Threads
1,215,081
Messages
6,123,016
Members
449,093
Latest member
ikke

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