Results 1 to 5 of 5

Macro Doesn't Work With Command Button

Threaded View

  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


        Application.ScreenUpdating = False
        ActiveSheet.Unprotect
        
        Range("A4").Select
        ActiveCell.FormulaR1C1 = "Seller ID"
        Range("B4").Select
        ActiveCell.FormulaR1C1 = "Seller Name"
        Range("C4").Select
        ActiveCell.FormulaR1C1 = "Subtotal"
        Range("D4").Select
        ActiveCell.FormulaR1C1 = "70%"
        Range("E4").Select
        ActiveCell.FormulaR1C1 = "30%"
        Range("F4").Select
        ActiveCell.FormulaR1C1 = "Remit to State"
        Range("A4:F4").Select
        Selection.Font.Bold = True
    
       
        Range("A2:B2").Select
    
        
        Range("A5:F65536").Select
        Selection.ClearContents
        Range("A4").Select
                
        Sheets("Seller Info").Activate
        ActiveSheet.Unprotect
        Range("A5:B65536").Copy Destination:=Sheets("Totals").Range("A65536").End(xlUp).Offset(1, 0)    
        Sheets("Totals").Activate
            
        Range("A5:F12").Select
        Range(Selection, Selection.End(xlDown)).Select
        Selection.Borders(xlDiagonalDown).LineStyle = xlNone
        Selection.Borders(xlDiagonalUp).LineStyle = xlNone
        Selection.Borders(xlEdgeLeft).LineStyle = xlNone
        Selection.Borders(xlEdgeTop).LineStyle = xlNone
        Selection.Borders(xlEdgeBottom).LineStyle = xlNone
        Selection.Borders(xlEdgeRight).LineStyle = xlNone
        Selection.Borders(xlInsideVertical).LineStyle = xlNone
        Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
        Range("A4").Select
    Last edited by jbmerrel; 03-14-2012 at 03:53 PM.

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