+ Reply to Thread
Results 1 to 5 of 5

Macro Doesn't Work With Command Button

  1. #1
    Registered User
    Join Date
    12-14-2010
    Location
    Texas,United Stated
    MS-Off Ver
    Excel 2007
    Posts
    63

    Macro Doesn't Work With Command Button

    I need a macro that will copy Range A5:B65536 on sheet1 (Sheet name - "Seller Info") and copy to sheet 2 (Sheet Name - "Totals"). See code below. When I run this as a macro in Module 1, it runs flawlessly. I want to run this macro through a command button. It does not give me the run time error... it just wont copy and paste. I put the code that is not working in bold font.

    Thanks in Advance

    jbmerrel


    Please Login or Register  to view this content.
    Last edited by jbmerrel; 03-14-2012 at 03:53 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: Macro Doesn't Work With Command Button

    Hi,

    Can't see any Bold font.
    Almost impossible to diagnose without seeing the problem in context. Why don't you upload the workbook so that we can take a look.

    One thought. Is this a .xls file where the last row is 65536? If so if you are copying A5:B65536 and the .End(xlup) takes you to a row below row 5 on the totals sheet then Excel will presumably complain since there's no room to paste 65532 rows.

    Are you sure you really do want to be copying nigh on the max. number of rows?

    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 Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Macro Doesn't Work With Command Button

    So which sheet is the active sheet at the start of your posted code?

    Your code switches off screen updating without restoring it - not a good idea.

    This is a guess at what you want

    Please Login or Register  to view this content.
    Hope that helps.

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

    Free DataBaseForm example

  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: Macro Doesn't Work With Command Button

    See also - How to add a button

    http://excel-it.com/add_button.htm

  5. #5
    Registered User
    Join Date
    12-14-2010
    Location
    Texas,United Stated
    MS-Off Ver
    Excel 2007
    Posts
    63

    Re: Macro Doesn't Work With Command Button

    That it!!! Thanks royUK!!!

+ 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