Results 1 to 4 of 4

Command Button with macro

Threaded View

GJR Command Button with macro 03-24-2014, 11:56 AM
Winon Re: Command Button with macro 03-24-2014, 01:04 PM
GJR Re: Command Button with macro 03-24-2014, 01:44 PM
Winon Re: Command Button with macro 03-24-2014, 01:53 PM
  1. #1
    Registered User
    Join Date
    09-16-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    10

    Command Button with macro

    I have a simple purchase order that has two buttons. One button print/save, I have that working Okay. The other button I want to use a message box to ask if you want a new purchase order, if no is selected exit sub. If yes is clicked, it needs to clear certain cells and add one to a cell to create the new invoice.

    I can get these to work individually, but not on the same button.

    Appreciate some help!

    I have attached the file...it does have a macro.
    OR
    Below is VBA:

    Private Sub CommandButton2_Click()
    Dim NewInvoice
    MsgBox "New Invoice", (vbYesNo), ("Clear Contents")
    If NewInvoice = "" Then Exit Sub
    Range("I1").Value = NewInvoice
    NewInvoice = "I1" + 1
    
    With NewInvoice("BD_ORDER_FORM")
    .Range("b5,b6,b8,b10,b11,f13:g42").ClearContents
    End With
    
    
    End Sub
    Attached Files Attached Files
    Last edited by GJR; 03-24-2014 at 01:39 PM. Reason: Wasn't sure if someone would open a macro enabled file

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Command Button Macro
    By mgs in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-20-2013, 09:26 PM
  2. Run a macro from a command button
    By Dave7554 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-20-2009, 11:06 AM
  3. macro will not run on command button
    By SRJ2665 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-21-2009, 09:58 AM
  4. Replies: 1
    Last Post: 09-17-2007, 09:57 PM
  5. [SOLVED] command button:Can i use a command button to open diffrrent sheets
    By Hellboy in forum Excel General
    Replies: 0
    Last Post: 11-03-2005, 11:00 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