+ Reply to Thread
Results 1 to 5 of 5

macro works but when added to button macro, it fails, dont know why

  1. #1
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    macro works but when added to button macro, it fails, dont know why

    i have the following macro that works, note that the activecell's are named ranges (1 cell) found on the "navigation (2)" sheet

    Please Login or Register  to view this content.
    now here is the button macro that fails on range d9, what it does is copy from a template, name it, then put in values from the navigation sheet.

    Please Login or Register  to view this content.
    can someone explain why its not working as expected?

  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: macro works but when added to button macro, it fails, dont know why

    Hi,

    Purely from the code I can see nothing obvious. WOuld you upload the workbook so that we may test in context.
    We can also simplify the code considerably. You don't need all the .Select stuff.
    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
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: macro works but when added to button macro, it fails, dont know why

    uploaded it now. i deleted the sheet named "a". so go to the navigation (2) page, find A and press the Add button to the right. then it fails with a 1004 error. please don't laugh how i coded this sheet, i can only program what i know how to do, so im sure there is better ways to implement the Add's and Deletes.
    i appreciate the help richard, thanks.

    Create 1.xlsm

  4. #4
    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: macro works but when added to button macro, it fails, dont know why

    Using your current code you need


    Please Login or Register  to view this content.
    However much better would be

    Please Login or Register  to view this content.
    End Sub

  5. #5
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: macro works but when added to button macro, it fails, dont know why

    that worked, wish i had your brain, life would be so much easier. one gold star for 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] HELP - This Macro works on small amounts of data but fails on large amounts
    By BookmanNLA in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-18-2015, 12:40 AM
  2. Code fails when ran within Userform, but works when ran from Macro button on worksheet.
    By Nitefox in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 6
    Last Post: 11-29-2013, 02:28 AM
  3. Replies: 5
    Last Post: 05-04-2013, 01:42 PM
  4. Database Query macro works in Excel 2003 but fails in Excel 2007
    By NBVC in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 03-11-2012, 12:24 PM
  5. Macro run fails, step through works.
    By SteveAlston in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-15-2009, 11:37 PM
  6. Macro works fine on PC; fails on Mac
    By marlea in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-20-2006, 04:35 PM
  7. [SOLVED] Button fails to call macro when open an Excel via Intranet
    By tigertax in forum Excel General
    Replies: 1
    Last Post: 04-12-2005, 06:06 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