Application.Run Activecell.value err 1004

drom

Well-known Member
Joined
Mar 20, 2005
Messages
527
Office Version
  1. 2021
  2. 2019
  3. 2016
  4. 2013
  5. 2011
  6. 2010
  7. 2007
Hi and Thanks in advance!

If i run the Macro M001
I get the message Hello M001​
But when I run the macro AA and my Activecell is =M001
I get err 1004​

If My Activecell value is M001
And I have the following code:

VBA Code:
Sub AA()  'aTxTs
Dim wCell As String:  wCell = ActiveCell.Value
   Application.Run wCell
End Sub

Sub M001()
 MsgBox "HELLO, M001"
End Sub

Sub M002()
 MsgBox "HELLO, M002"
End Sub

Sub M003()
 MsgBox "Bye Bye, M003"
End Sub


Why?
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
This runs fine for me if I put Test in the activecell. It throws the error 1004 if I name the called sub M001 and have M001 in the activecell. Can also get it to run if the called sub is named M_001 and M_001 appears in the activecell. No cogent explanation comes to mind.
VBA Code:
Sub AA()
Dim wCell As String:  wCell = ActiveCell.Value
   Application.Run wCell
End Sub

Sub Test()
 MsgBox "HELLO, M001"
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,427
Members
448,961
Latest member
nzskater

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