Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Reference must be to a macro sheet" error

Tags:

excel

vba

Hi I have this simple code that follows a hyperlink, and I am trying to assign it to a button but I get

Reference must be to a macro sheet

error. In the module there are no references to any sheets as this is just a simple command opening up IE via cmd. What am I doing wrong?

Sub CAV2()
  'For MAGCRD1 (link is for illustration)
   Shell "CMD.EXE /C START """" """ & "www.google.com" & """"
End Sub
like image 727
Rhyfelwr Avatar asked Jan 17 '26 12:01

Rhyfelwr


2 Answers

CAV2 is legal sheet's cell reference. Choose another name for procedure.

like image 163
JohnyL Avatar answered Jan 20 '26 05:01

JohnyL


the name of the subprocedure (CAV2) is not permitted by VBA. The number "2" is the culprit, change it and everything will work fine

like image 22
victor ubong Avatar answered Jan 20 '26 05:01

victor ubong



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!