+ Reply to Thread
Results 1 to 5 of 5

Help: Macro works...But not on pressing button

  1. #1
    Registered User
    Join Date
    08-22-2017
    Location
    Holland
    MS-Off Ver
    2016
    Posts
    3

    Help: Macro works...But not on pressing button

    Dear forum familie, (SOLVED, Thanks)

    I'm working on a excel project and i'm a bit stuck.

    I made a VBA script works fine if i call the macro from within the visual basic UI. But when i assign a button on that same macro it gives me a 400 error or it runs a part of it.

    One button works fine tho, but why the errors on other buttons?

    Anyone ever had such problem?


    Hope you guys can help,

    Mark

    Below coding (not that it's necessary it works, only the buttons are doing weird...)

    Please Login or Register  to view this content.
    And the call functions

    Please Login or Register  to view this content.
    Last edited by MarkBrink; 08-22-2017 at 08:11 AM. Reason: Solved

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: Help: Macro works...But not on pressing button

    My guess, is that not all your objects are properly defined within context.

    For an example. When you write Range("A1"). This refers to cell A1 of Active sheet.

    If the sheet in question isn't active, you must qualify it with sheet name or sheet index (ex. Sheet1.Range("A1"))

    Typically done by using With... End With and/or defining parent object variable.
    "Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something."
    ― Robert A. Heinlein

  3. #3
    Registered User
    Join Date
    08-22-2017
    Location
    Holland
    MS-Off Ver
    2016
    Posts
    3

    Re: Help: Macro works...But not on pressing button

    CK76 Good Guess!

    It works great now, that was rather easy....

    But most appreciated!

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: Help: Macro works...But not on pressing button

    You are welcome If your issue is resolved, please mark thread as solved by using Thread tool found at top of your original post.

  5. #5
    Registered User
    Join Date
    08-22-2017
    Location
    Holland
    MS-Off Ver
    2016
    Posts
    3

    Re: Help: Macro works...But not on pressing button

    Done, Thank you!

+ 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] SUMPRODUCT works with F9 but pressing ENTER results in #VALUE!
    By ChasGrad in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-06-2016, 11:38 PM
  2. Auto call macro without pressing button
    By skhari in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-17-2015, 08:56 PM
  3. Replies: 1
    Last Post: 09-14-2014, 02:10 PM
  4. show area when pressing macro button
    By ossa in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-28-2012, 09:19 AM
  5. Macro to create form by pressing button
    By nani_nisha06 in forum Access Programming / VBA / Macros
    Replies: 0
    Last Post: 06-04-2012, 02:55 PM
  6. Macro to create form by pressing button
    By jesika in forum Access Programming / VBA / Macros
    Replies: 3
    Last Post: 06-04-2012, 02:35 PM
  7. Pressing a button using a macro
    By Todd in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-06-2005, 04:05 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