+ Reply to Thread
Results 1 to 6 of 6

Can't execute a macro whit text inside procedure header's "()" *Help*

  1. #1
    Registered User
    Join Date
    01-24-2012
    Location
    Lund, Sweden
    MS-Off Ver
    Excel 2003
    Posts
    3

    Can't execute a macro whit text inside procedure header's "()" *Help*

    If I try to execute a macro whit the procedure header being like this: Sub test (Byval Target As Range)
    it doesn't work, instead a new window called Macros comes up.
    I have tried older codes that I have saved in a .txt and that I know worked befor but it's still the same problem.
    It is not a problem when im trying to run macros like: Sub test()

    Sub test() 'Works
    Sub test (Byval Target As Range) 'Doesn't Work

    I am new to VBA and fairly new to Excel tbh, so i did not know where to turn.
    Last edited by Timestamp; 01-24-2012 at 06:57 AM.

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Can't execute a macro whit text inside procedure header's "()" *Help*

    do you mean like this?
    Please Login or Register  to view this content.

  3. #3
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Can't execute a macro whit text inside procedure header's "()" *Help*

    You cannot run a macro that requires a range argument from the macros dialog, if that is what you are attempting, because you have no way to pass that range to it from the dialog.
    Good luck.

  4. #4
    Registered User
    Join Date
    01-24-2012
    Location
    Lund, Sweden
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Can't execute a macro whit text inside procedure header's "()" *Help*

    What I mean is, if I do a macro like this:

    Private sub Worksheets_change(ByVal Target As range)
    Application.EnableEvents = False
    Range("A1").Value = Target.Value
    Application.EnableEvents = True

    or

    Function nExists(FindName As string) As boolean
    Dim Rng as Range
    Dim myName as String
    On Error Resume Next
    myName = ActiveWorkbook.Names(FindName).Name
    If Err.Number = 0 then
    NameExists = True
    Else
    NameExists = False
    End If
    End Function

    I Can't write any code that needs text inside the "()".
    Hope you understand, dont know how else to explain it.

  5. #5
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Can't execute a macro whit text inside procedure header's "()" *Help*

    How are you trying to call/execute these macros?

  6. #6
    Registered User
    Join Date
    01-24-2012
    Location
    Lund, Sweden
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Can't execute a macro whit text inside procedure header's "()" *Help*

    Yee thanks Kyle123, thats it.
    The memory is good but short.

    Here i been spaming F5

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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