Rhyfelwr
Rhyfelwr

Reputation: 329

"Reference must be to a macro sheet" error

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

Upvotes: 3

Views: 19374

Answers (2)

victor ubong
victor ubong

Reputation: 11

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

Upvotes: 1

JohnyL
JohnyL

Reputation: 7152

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

Upvotes: 6

Related Questions