+ Reply to Thread
Results 1 to 5 of 5

'Argument not optional'

  1. #1
    Forum Contributor
    Join Date
    06-16-2011
    Location
    London
    MS-Off Ver
    Excel XP
    Posts
    276

    'Argument not optional'

    I know why I'm getting the error.....cos my macro begins with:

    Please Login or Register  to view this content.
    I need the variable passed from another macro for reasons that don't matter but I also need to be able to run this macro from a button. I get the error when running it from a button, obviously because the HWflag variable doesnt exist at that point but does when this macro is run from another macro. I've tested running this from a button without the (HWflag as integer) and it works fine so I'm positive what the error is, I just don't know how to cure it.

    What I need to know is how to pass a variable (of 0 value) to this macro from a command button click.

    I'm sure this is a bonehead question from a noob though.
    Last edited by swoop99; 09-14-2011 at 12:04 PM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: 'Argument not optional'

    Hi,

    Have you tried running an introductory macro from the button such that the introductory macro then calls the macro in question passing a zero value?

    Regards
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Contributor
    Join Date
    06-16-2011
    Location
    London
    MS-Off Ver
    Excel XP
    Posts
    276

    Re: 'Argument not optional'

    Disregard, found it.

    Please Login or Register  to view this content.
    Knew it was a bonehead question

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: 'Argument not optional'

    I can't see how you are giving the variable a value.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Forum Contributor
    Join Date
    06-16-2011
    Location
    London
    MS-Off Ver
    Excel XP
    Posts
    276

    Re: 'Argument not optional'

    From the buttons it's just an assigned macro and no variable is passed. From the other macro I call this macro with:

    Please Login or Register  to view this content.

+ 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