Macro stopped running

matthewlouis

Active Member
Joined
Mar 28, 2014
Messages
374
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
When I open worksheet, there is a macro that is supposed to run. When I hit Alt F11, the box is grayed out with no code.

I don't code, just a formula guy, this was a macro someone here on the board helped me with. So I am dense on coding. But this is a great macro.

When I open the worksheet, I am not asked anything. I went to File>Info> and the Security Information is not restricting (I trust the source).

What happened to the macro and why is the box grayed out and no code is there?

Thanks in advance!
 
If you add this VBA code to the "ThisWorkbook" module, I think it will do what you want:
VBA Code:
Private Sub Workbook_Open()
    Call clicky
End Sub
Then, every time you open the workbook, as long as VBA/Macros are enabled, your "clicky" procedure will run automatically.
 
Upvote 0

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Closed, opened, it said ambiguos name detected clicky
That is because I believe that you said that you copied "clicky" and pasted it in a different module.
So it now appears in two places in your workbook. Just delete one of them - you don't need it in two places.
 
Upvote 0
Still not working. Look at the attached.
 

Attachments

  • 93.png
    93.png
    22.5 KB · Views: 2
Upvote 0
I am guessing that is because you have a multi-sheet workbook, and since none of your the ranges in your code have sheet qualifications, it is simply running against whatever sheet it opens up to (and if it is not the correct sheet, you may get errors!).

Which sheet does this data (cell K2) reside in?
You can fix it by adding a line that tells your VBA code which sheet to run against, i.e.
Rich (BB code):
Sub clicky()
   Sheets("YourDataSheetNameHere").Select
'    Rest of your code below...
 
Upvote 0
OK, let me add that line.

Once added, again, do I close the sheet and reopen and that will run the macro?
 
Upvote 0

Forum statistics

Threads
1,215,442
Messages
6,124,886
Members
449,194
Latest member
ronnyf85

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