recorded macro

Peterfc2

Active Member
Joined
Jan 2, 2004
Messages
402
Office Version
  1. 2013
Platform
  1. Windows
Application.Run "crt2.xls!newmonthly_Button2_Click"
Sheets("sep").Select
Application.Run "crt2.xls!newmonthly_Button2_Click"
Sheets("oct").Select
Application.Run "crt2.xls!newmonthly_Button2_Click"
Sheets("nov").Select
Application.Run "crt2.xls!newmonthly_Button2_Click"
Sheets("dec").Select
Application.Run "crt2.xls!newmonthly_Button2_Click"
Sheets("jan").Select
Application.Run "crt2.xls!newmonthly_Button2_Click"
Sheets("feb").Select
Application.Run "crt2.xls!newmonthly_Button2_Click"
Sheets("mar").Select
Application.Run "crt2.xls!newmonthly_Button2_Click"
Sheets("apr").Select
Application.Run "crt2.xls!newmonthly_Button2_Click"
Sheets("may").Select
Application.Run "crt2.xls!newmonthly_Button2_Click"
Sheets("aug").Select
Range("J2").Select

I recorded the macro above which which runs macro buttons on sheets Aug to Sep.

When I save the spreadsheet as crt1 it does not work. Solution please
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Hi Peter,

If you change the name of the spreadsheet, you would need to change each line of code that references "crt2.xls" to the new file name. In this case it would read "crt.xls!newmonhtly_Button2_Click".

Cheers!
 
Upvote 0
Where is newmonthy_Button2_Click?

if it is in a normal module you could use
Code:
Application.Run "newmonthy_Button2_Click"

It would also be faster if newmonthy took a sheet as its argument so you could avoid all that selecting. Could you post newmonthy...
 
Upvote 0
Where is newmonthy_Button2_Click?

if it is in a normal module you could use
Code:
Application.Run "newmonthy_Button2_Click"

It would also be faster if newmonthy took a sheet as its argument so you could avoid all that selecting. Could you post newmonthy...[/QUOTE]

Sorted! just edited out crt2.xls! and it works fine. Thanks all.
 
Upvote 0

Forum statistics

Threads
1,222,415
Messages
6,165,893
Members
451,992
Latest member
kaurmanjodh

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