+ Reply to Thread
Results 1 to 6 of 6

Problem with running Macro from Button form control

  1. #1
    Forum Contributor
    Join Date
    01-08-2017
    Location
    Salt Lake City, Ut.
    MS-Off Ver
    2019 and 365
    Posts
    135

    Question Problem with running Macro from Button form control

    This is sort of related to an earlier post I made regarding ghost button, where it was decided that it would be better to use the button from control rather than ActiveX button controls. I initially began replacing the ActiveX controls with Button form controls on my ledger sheet and all worked well.
    Then I first tried copying several of the buttons to a sheet I call Manager, which contains nothing but buttons for various functions. I was hoping by doing it this way that it would save me some time individually creating the same buttons to do virtually the same job but from a different worksheet. That failed, it would take me to some other place in my code and simply STOP. So I suspected that I could not copy the Button form controls from anther sheet, and created one on the Manager sheet to test. In created the following Macro to run from the button form control"
    Please Login or Register  to view this content.
    As you can see, it is a very simple procedure to take me to the JanSwitch routine, that basically takes me to the January tab.

    What is strange is, that if I click on this new button on the Manager tab to run the above code, it also takes me into my code and then just Stops, but if I go directly to the macro shown above and then click in it and click Run Sub, it works just fine.

    Is anyone aware of why this occurs, or if I am overlooking something?

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,700

    Re: Problem with running Macro from Button form control

    Maybe you need:

    Please Login or Register  to view this content.
    Pretty sure that when you are running a macro from the VB Editor, ScreenUpdating has no effect.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    01-08-2017
    Location
    Salt Lake City, Ut.
    MS-Off Ver
    2019 and 365
    Posts
    135

    Re: Problem with running Macro from Button form control

    No change. I do not normally include the true function in my switch code as the other routines that follow I also do not want any screen flashing to occur. In any case, I tried it, but it still does not work, unless I run it directly from within the macro rather than using the button.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,700

    Re: Problem with running Macro from Button form control

    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  5. #5
    Forum Contributor
    Join Date
    01-08-2017
    Location
    Salt Lake City, Ut.
    MS-Off Ver
    2019 and 365
    Posts
    135

    Re: Problem with running Macro from Button form control

    I found the problem, I had inserted another routine to fix a problem that was occurring in another part of the workbook.. I realized that one month switch worked fine while others did not, once I isolated it to the routine and removed it from the switch, everything works fine.

    What was happening is that this routine was trying to land the cursor on a locked area of the worksheet. That was throwing the code out of whack.

    I still want to thank everyone for their input. I have found the Excel Forum extremely helpful and value everyone's input.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,700

    Re: Problem with running Macro from Button form control

    You're welcome.


    Glad you sorted it out.

+ 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. Macro Deletes Form Control Button
    By mvparker79 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-25-2020, 07:53 PM
  2. Which Macro Is in My Form Control Button?
    By eNinjaInTraining in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-30-2018, 11:18 PM
  3. Button (Form Control) - Macro enabled - VBA help??
    By gb10 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-29-2014, 05:43 PM
  4. Option button (Form control) problem
    By vipati in forum Excel General
    Replies: 5
    Last Post: 05-15-2014, 05:16 AM
  5. Creating a macro and form control button
    By kaye.roberts393 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-09-2013, 02:13 PM
  6. Macro-Button (form Control)
    By mjali001 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-16-2013, 09:52 PM
  7. problem a macro with form control button
    By initialcondition in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-17-2011, 01:09 PM

Tags for this Thread

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