+ Reply to Thread
Results 1 to 21 of 21

Updating the selected item from the listbox based on the last column of the row preceding

  1. #1
    Forum Contributor
    Join Date
    05-24-2021
    Location
    Palestine
    MS-Off Ver
    2019
    Posts
    284

    Updating the selected item from the listbox based on the last column of the row preceding

    Hello
    Everything works fine for me except for the last column in the list box. What I want when I choose a specific item from the list box and update its data is to reset the balance calculation for the selected item from the list box based on the row that precedes it for the balance column.
    Let's take an example of the second row in the list box. In the first picture, the item is selected
    In the second picture, the value of the fifth column of the selected element is changed, then the control button is pressed to update . In the third picture, it is marked in red. The value in the last column of the selected element has not changed. The fourth picture is right value where the value is taken from the row that precedes it and the equation is in this form 1233 + 1233 -100 = 2366 and should also update next rows for the same name to become 2366-2000=366 , 366-466=-100 as in last pictur
    Any row that is modified when calculating in the last column must take the value from the row that precedes for the last column and add to the value of the fourth column and subtract it from the fifth column of the selected element.
    But if you choose the first row, then the fourth column will be subtracted from the fifth column in case the first row is updated in the List Box.
    Last thing I want implemnt the whole codes for two sheets based on selected sheet from combobox
    I hope the idea is clear
    thanks
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by Alaa-A; 11-07-2022 at 08:37 PM.

  2. #2
    Forum Contributor
    Join Date
    05-24-2021
    Location
    Palestine
    MS-Off Ver
    2019
    Posts
    284

    Re: Updating the selected item from the listbox based on the last column of the row preced

    I hope finding solution for this case guys.

  3. #3
    Forum Contributor
    Join Date
    05-24-2021
    Location
    Palestine
    MS-Off Ver
    2019
    Posts
    284

    Re: Updating the selected item from the listbox based on the last column of the row preced

    any help guys?

  4. #4
    Forum Contributor
    Join Date
    05-24-2021
    Location
    Palestine
    MS-Off Ver
    2019
    Posts
    284

    Re: Updating the selected item from the listbox based on the last column of the row preced


  5. #5
    Forum Contributor
    Join Date
    05-24-2021
    Location
    Palestine
    MS-Off Ver
    2019
    Posts
    284

    Re: Updating the selected item from the listbox based on the last column of the row preced

    seem extremely hard

  6. #6
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: Updating the selected item from the listbox based on the last column of the row preced

    Hello.
    I don't know why you mention this in the macro forum when it's a very simple Excel topic...
    Open the attached workbook: Do you see that the 'BALANCE' column appears to have incorrect values?...
    Then sort by the 'Name' column and look -again- at the 'BALANCE' column.
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    05-24-2021
    Location
    Palestine
    MS-Off Ver
    2019
    Posts
    284

    Re: Updating the selected item from the listbox based on the last column of the row preced

    thanks for your replying
    Do you see that the 'BALANCE' column appears to have incorrect values?...
    based on my file there is no error , let's take sheet TT
    based on the picture can you tell me where is the error ,please ?
    do you know how is calculate ?
    every name repeated is under each other of them for the same name calculates individually without is relating for the others names .
    based on your file I see this is wrong , where did you get it from ?
    note: if you mean the wrong the other sheet , yes you're right , sorry that's because I captured picture to explain what I want and forgot changing again , also I updated the file and last picture after updated the selected row in list box also should updated next rows for the same name and the same way to calculation as in last picture where mark red color .
    Attached Images Attached Images
    Last edited by Alaa-A; 11-07-2022 at 08:43 PM.

  8. #8
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: Updating the selected item from the listbox based on the last column of the row preced

    Every time you enter a new data, sort the data range by name and the balance will be calculated only with the suggested formula.

  9. #9
    Forum Contributor
    Join Date
    05-24-2021
    Location
    Palestine
    MS-Off Ver
    2019
    Posts
    284

    Re: Updating the selected item from the listbox based on the last column of the row preced

    I don't understand you .
    I need updating data by select the item from listbox , then should update next rows for the same name with the same formula . not add new data .

  10. #10
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: Updating the selected item from the listbox based on the last column of the row preced

    Let's see if this is what you're asking:

    PHP Code: 
    Private Sub CommandButton1_Click() ' <Add>
    TextBox1 = Now
    If Not toValidate Then Exit Sub
    ListBox1.RowSource = ""
    tbl.ListRows.Add
    toRegister tbl.ListRows.Count
    End Sub 
    Last edited by beyond Excel; 11-09-2022 at 08:36 AM.

  11. #11
    Forum Contributor
    Join Date
    05-24-2021
    Location
    Palestine
    MS-Off Ver
    2019
    Posts
    284

    Re: Updating the selected item from the listbox based on the last column of the row preced

    thanks for this file, but I have a question, do you test it?
    Actually I don't note any changes in listbox or sheet when press modifying button, may you check it, please?

  12. #12
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: Updating the selected item from the listbox based on the last column of the row preced

    Notice how the balance changes...

  13. #13
    Forum Contributor
    Join Date
    05-24-2021
    Location
    Palestine
    MS-Off Ver
    2019
    Posts
    284

    Re: Updating the selected item from the listbox based on the last column of the row preced

    Notice how the balance changes...
    I'm not sure you try to tell me that works or ask how the balance changes !
    anyway here is some detail maybe help you .
    when I select the item and change debit or credit in listbox then will take the balance of row where preceding it +debit -credit for the selected item need updating . as to next rows after selected item will take the balance from selected item is updated +debit-credit up to finish the whole data for the same name . so for each next row after selected item is updated will take the balance from prevouis row(selected item is updated ) and add to debit minu credit also the selected item is changed,also take the balance from prevouis row and add to debit minus credit.
    I hope this help you

  14. #14
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: Updating the selected item from the listbox based on the last column of the row preced

    See if this helps you: Change the value you want and click the Modify button: See the resulting balance!
    Attached Files Attached Files
    Last edited by beyond Excel; 11-09-2022 at 08:35 AM.

  15. #15
    Forum Contributor
    Join Date
    05-24-2021
    Location
    Palestine
    MS-Off Ver
    2019
    Posts
    284

    Re: Updating the selected item from the listbox based on the last column of the row preced

    it's perfect , just question is it possible show the formula as in value in table?

  16. #16
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: Updating the selected item from the listbox based on the last column of the row preced

    The solution doesn't seem so perfect since you didn't add '+rep' to post #14.

  17. #17
    Forum Contributor
    Join Date
    05-24-2021
    Location
    Palestine
    MS-Off Ver
    2019
    Posts
    284

    Re: Updating the selected item from the listbox based on the last column of the row preced

    I have excuse buddy
    see waht I posted in another section about this problem .
    https://www.excelforum.com/the-water...e-members.html

  18. #18
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: Updating the selected item from the listbox based on the last column of the row preced

    Hello. I think you will like this version better.

    Notice what happens when you start typing a name. Also see what happens if you start typing an intermediate letter like 'A'
    Attached Files Attached Files

  19. #19
    Forum Contributor
    Join Date
    05-24-2021
    Location
    Palestine
    MS-Off Ver
    2019
    Posts
    284

    Re: Updating the selected item from the listbox based on the last column of the row preced

    thanks again
    may you check second sheet?
    the formula still shows .

  20. #20
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: Updating the selected item from the listbox based on the last column of the row preced

    The formulas are the ones that solve your problem: Why do you want to eliminate them?...

  21. #21
    Forum Contributor
    Join Date
    05-24-2021
    Location
    Palestine
    MS-Off Ver
    2019
    Posts
    284

    Re: Updating the selected item from the listbox based on the last column of the row preced

    I don't need any formula to avoid any clearing inaccidentally if I select any cell . just all of what I depend on codes .
    if it's hard for you I will satify up to this .

+ 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] how to get the next item value based on the selected item in userform listbox ?
    By karmapala in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-27-2019, 05:49 AM
  2. [SOLVED] using a listbox, how to get the selected item
    By dmcgov in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-01-2019, 02:26 PM
  3. [SOLVED] Moving all columns from listbox 1 to listbox 2 and see all details of an selected item
    By alexgoaga in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-05-2018, 07:09 PM
  4. [SOLVED] Populate controls based on selected multicolumn Listbox item
    By terriertrip in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-13-2017, 04:30 PM
  5. Get the name of a listbox where an item is selected
    By Jerbinator in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-22-2016, 03:16 PM
  6. Selected item in first listbox.
    By waka in forum Access Tables & Databases
    Replies: 1
    Last Post: 02-09-2015, 11:45 PM
  7. Updating time in realtime based on city in preceding cell
    By bholabhala in forum Excel General
    Replies: 23
    Last Post: 01-12-2010, 04:53 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