Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Macro on different worksheets

0

How can I use a macro on Sheet1 on other sheets, Sheet2, Sheet3, ect.?

Answer
Discuss

Discussion

OK, I figured it out.  You put the code in a Module, instead of a Sheet.
orkrj (rep: 14) Jul 5, '20 at 6:50 pm
Absolutely! The code sheets for each worksheet, including the one aptly named ThisWorkbook, have special links to their subject and you shouldn't use them for any code that doesn't require these links. While you don't know how to use these links to your advantage that prohibition is rther comprehensive.
Here is a tip. These modules capture "events" that occur either in the Workbook or on one of its sheets. You can use such "events" to run code automatically when they occur. Typical such "events" are when the workbook is opened or closed or when a change occurs in a worksheet.
Variatus (rep: 4889) Jul 6, '20 at 4:41 am
Add to Discussion

Answers

0
Selected Answer

OK, I figured it out.  You put the code in a Module, instead of a Sheet.

Discuss


Answer the Question

You must create an account to use the forum. Create an Account or Login