+ Reply to Thread
Results 1 to 6 of 6

Need help getting buttons to command correct row

  1. #1
    Registered User
    Join Date
    01-21-2014
    Location
    Texas
    MS-Off Ver
    Office Pro Plus 2010
    Posts
    3

    Need help getting buttons to command correct row

    A little back story on the project, I have invoices I am wanting to put in this new workbook and have 2 sheets, paid and unpaid. I have a macro tied to a button that will insert a new row, change all the formatting and add a button to the end of the row that says "Paid", i can then add all of the invoice information. I can press the New Invoice button and it will correctly insert and reformat rows to my liking. I then have a second macro tied to the Paid button that should move the row the Paid button is on from the Unpaid sheet to the Paid sheet and reformats the row.

    The problem i have now is that invoices do not get paid in the order i input them but each new Paid button that was created only points to the row it was created on (A6) so as I add row after row and an invoice 10 rows down is paid, i click the button and it removes the very top (A6) row and moves it to the Paid sheet, not the row i needed (A16).

    I need to figure out how to make the buttons keep track of the row number they are currently on so that they moves the correct row. I know that lots of buttons is sloppy programming, and i would much rather have the initial macro add checkboxes that i can select when invoices are paid and have just 1 button to move all paid invoices but it's been like a decade since i did any programming and i can't remember how to do anything at all.


    Thanks for the help,

    Devon

  2. #2
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Need help getting buttons to command correct row

    A sample file with non sensitive data and the codes you are currently using can help a lot in getting a to the point answer.

    Regards, bakerman2

  3. #3
    Registered User
    Join Date
    01-21-2014
    Location
    Texas
    MS-Off Ver
    Office Pro Plus 2010
    Posts
    3

    Re: Need help getting buttons to command correct row

    Here you go.
    Attached Files Attached Files

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Need help getting buttons to command correct row

    Devon,

    Try next one.
    When you click Paid Invoices button a Userform appears. In that userform is a listbox with all open Invoices. You can select one or more invoices by clicking on them.
    After selecting click Move to paid button and all selected invoices are copied to Paid Invoices sheet and deleted from Open Invoices sheet.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    01-21-2014
    Location
    Texas
    MS-Off Ver
    Office Pro Plus 2010
    Posts
    3

    Re: Need help getting buttons to command correct row

    Hey that works really good! You did a lot more than i was expecting, i was ready for just some coaching on code.

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Need help getting buttons to command correct row

    Nice to hear.
    Why not make a similar userform for inputting invoices? Or combine the two things in one ?
    That way you don't have to mess around on your spreadsheet.
    Let me know if there's any interest for that.

+ 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. Dynamically created buttons not landing over correct cell?
    By shanecb in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-05-2013, 01:50 PM
  2. use a command button to click other command buttons
    By fcharl9 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-20-2013, 08:48 PM
  3. Radio buttons do not return correct data from pivot table.
    By jaimeteele in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-26-2013, 05:15 AM
  4. Useform Code - 12 Command Buttons dependant on other command buttons
    By darrenkaye in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-20-2013, 10:58 AM
  5. Master Command Button to call on other Command Buttons located in other Workbooks
    By MrNickRegan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-05-2013, 07:57 PM
  6. Code for a master command button to change the backcolor of multiple command buttons?
    By panttherm5 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-16-2012, 10:11 PM
  7. Linking command buttons to option buttons
    By sealtite01 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-20-2012, 12:25 PM
  8. command buttons:label of a command button
    By stoney1977 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-08-2008, 07:16 PM

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