+ Reply to Thread
Results 1 to 6 of 6

Anyone know why I'm getting this error when calling this macro?

  1. #1
    Registered User
    Join Date
    04-22-2020
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    21

    Anyone know why I'm getting this error when calling this macro?

    Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
    If Target.Range.Address = "$J$1" Then
    Call SaveValues
    End If

    End Sub


    Hoping i attached the image...

    Compile error.png

    The Module runs fine by itself

  2. #2
    Registered User
    Join Date
    03-04-2013
    Location
    Mexico
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Anyone know why I'm getting this error when calling this macro?

    Does SaveValues have required parameters? If not, try without "Call"

  3. #3
    Registered User
    Join Date
    04-22-2020
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    21

    Re: Anyone know why I'm getting this error when calling this macro?

    Thanks Jorge, Hmm.. does seem to work either.

    My other module is this:
    Sub SaveValues()
    ActiveSheet.Copy
    Cells.Copy
    Range("A1").PasteSpecial Paste:=xlPasteValues
    Application.CutCopyMode = False
    End Sub

  4. #4
    Registered User
    Join Date
    03-04-2013
    Location
    Mexico
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Anyone know why I'm getting this error when calling this macro?

    The code you posted works for me. Do you have a private statement in your Module?

    Try taking the savevalues sub and putting it on the same worksheet . It should work. Or check that your module doesnt have "Option Private Module".

  5. #5
    Registered User
    Join Date
    03-04-2013
    Location
    Mexico
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Anyone know why I'm getting this error when calling this macro?

    Oh, I know what it is. Your module is named the same as the procedure "SaveValues". Change the module name and it should work

  6. #6
    Registered User
    Join Date
    04-22-2020
    Location
    Australia
    MS-Off Ver
    2013
    Posts
    21

    Re: Anyone know why I'm getting this error when calling this macro?

    YES! That's it! Thank you Jorge! (Changed name of module.)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Error calling multiple Macros from Macro...
    By SUPPO_USN in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-22-2017, 12:17 PM
  2. Error when calling a 'sheet macro' inside a workbook wide macro
    By Rhino_dance in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-09-2016, 03:46 PM
  3. Fatal Error when calling macro via Alt+F8
    By bubi1080 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-03-2016, 06:19 PM
  4. [SOLVED] When looping through Workbooks calling Macro - Run-time error '9': Subscript out of range
    By trizzo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-10-2015, 07:17 AM
  5. [SOLVED] Problem with calling another macro (Error 450 and " Expected variable or procedure")
    By Roxner in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-07-2013, 04:59 AM
  6. Error when calling macro
    By jamer02 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-18-2013, 06:33 PM
  7. Calling named cell into macro calculation produces error
    By widodude in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-25-2011, 09:26 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1