Consulting

Results 1 to 15 of 15

Thread: populate balance on userform if existed in sheet and missed in another

  1. #1

    populate balance on userform if existed in sheet and missed in another

    Hi,
    this works for jindon and I hope to getting chance help again .

    I would add another condition to adjusting code for Private Sub GetData()
    what I search for it if the name is new in balance first of duration sheet and is not existed in sheet1 should show in listbox1 when select all from combobox or when clear in combobox .as to select the name will show as code does it .
    when there is new name in balance first of duration sheet and contains minus value then should show plus value in credit column(6) in listbox1 and if new name in balance first of duration sheet and contains plus value then should show plus value in debit column(5) as marked in picture.
    thanks in advanced.



    Attached Images Attached Images
    Attached Files Attached Files

  2. #2
    doesn't seem there is chance to getting help for this project.

  3. #3
    VBAX Tutor
    Joined
    Jul 2005
    Posts
    209
    Location
    Why balalnce for only 2?

    Need comppletely clear logic.
    Is it only for "all"?
    regrdless of dates???
    Last edited by jindon; 08-25-2025 at 08:02 PM.

  4. #4
    Hi jindon again ,
    Why balalnce for only 2?
    2 new names in balance first of duration sheet are example ,but will be many new names are transferred from previous year without they have movements in sheet1 , so I search for showing all of names for both sheets.
    Is it only for "all"?
    also should do that by select name and dates
    regrdless of dates???
    Dates should be taken into account.

  5. #5
    VBAX Tutor
    Joined
    Jul 2005
    Posts
    209
    Location
    1) What is "new"?
    How do you find which lines is/are "new"?

    2) How the dates should be taken account?

    You should show me the result(s) that you want in workbook and explain why in various cases.

  6. #6
    1) What is "new"?
    How do you find which lines is/are "new"?
    when there are names in balance first of duration like "amer,karrem and they are not existed in sheet1 when match column B between two sheets.

    2) How the dates should be taken account?
    you don't need to do that , because your code does that when select all and write dates ,
    the only thing what I want delete first row from showing in listbox
    the first row will sum balances from balance first of duration sheet , I don't need it because listbox2 will sum them . the listbox2 will sum all of balance for both sheets , but the problem in listbox2 will not show names are existed in balance first of duration sheet and are not existed in sheet1 . the listbox2 will depends on listbox1 . so to show names in listbox2 I need to show names in balance first of duration sheet and are not existed in sheet1 should show in listbox1
    based on picture delete first row and show new names in balance first of duration sheet as marked.
    be careful don't change the previous conditions in your original code.
    I hope the picture helps you.
    thanks for your time
    Attached Images Attached Images

  7. #7
    VBAX Tutor
    Joined
    Jul 2005
    Posts
    209
    Location
    You are really confusing me.

    I wrote that code as your requirement, and it was all good.
    you don't need to do that , because your code does that when select all and write dates


    What I meant was if the dates should be considered to create extra rows for "new" even the date are not in the range between From : To date.

    As I already asked, I need to see your desired result workbook in various situations, clearly showing the logic like "new" and "delete" etc. otherwise just wasting time.

  8. #8
    You are really confusing me.
    sorry !
    As I already asked, I need to see your desired result workbook in various situations, clearly showing the logic like "new" and "delete" etc
    I suppose you know the project how works that's why I just post one picture for new case .
    so do you want post all of cases what project does it ,or..?

  9. #9
    VBAX Tutor
    Joined
    Jul 2005
    Posts
    209
    Location
    Since you have changed the conditions, I need to see all the different results under various circumstances.

  10. #10
    CASE1 when select ALL from combobox1
    CASE2 when select ALL from combobox1 and dates from textboxes
    CASE3 when select name from combobox1 and dates from textboxes
    CASE4 when select name from combobox1
    CASE5 when no selected name from combobox1 and no dates from textboxes
    CASE6 when no selected name from combobox1 and write dates in textboxes
    when clear combobox1 will populate all of data and when clear dates from textboxes will populate all of data if combobox1 is empty
    as to listbox2
    the listbox2 merge amounts for data showing in listbox1 for columns 5,6 based on name column 2 and show result in listbox2 when select items from combobox1 or write dates in textboxes.
    ex: omar=2000+580000+1000+1000=584000
    and when there is name in balance first of duration sheet then should add to amount where is merged and if the amount is plus then when add to amount where is merged in listbox should be in debit
    ex:mariam =-5000-(100+500000)=505100

    so will be in kr picture
    so you can keep all of cases in listbox1 as you writing is ok but the problem will be in listbx2
    the new names should show in listbox2 when they are not existed in listbox1 then should brings from balance first of duration sheet.
    no need to populate in listbox1 , no need select from combobox1 , because they are not movements in sheet1 so will show as total in listbox2.
    listbox2 doesn't need dates because what show in listbox1 then will merge based on specific condition as I mentioned how should be in listbox2.
    Attached Images Attached Images

  11. #11
    VBAX Tutor
    Joined
    Jul 2005
    Posts
    209
    Location
    Your pictures shows nothing difference from my original code.

    As I mentioned already, if you don't post a workbook showing exact desired results on worksheet(s), not in picture, no way to understand, so ask someone else.

  12. #12
    Your pictures shows nothing difference from my original code.
    surely yes.
    and I said
    so you can keep all of cases in listbox1 as you writing is ok
    and the speech is around listbox2 as I said.
    but the problem will be in listbx2
    what I want to be show new names in listbox2 and I explain you how listbox2 collect balances for names.
    the listbox2 ignores names are existed in first sheet and not existed in second sheet
    the listbox2 should show new names as marked in last picture
    if you don't post a workbook showing exact desired results on worksheet(s)
    of course I post what you want , but the result should show on form , not on worksheet, that's why I posted pictures especially last picture
    if you insist last picture should show in worksheet then here is file as highlighted by red are new names.
    again listbox 2 depends on listbox1 , but when there are names are existed in first sheet , not existed in second sheet the should brings from first sheet and show in listbox2

    no way to understand
    honestly I do my best.

    so ask someone else.
    I don't think so because this is yours and about month ago of post this subject nobody answers me.
    Attached Files Attached Files

  13. #13
    Site Admin VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,507
    Location
    As Jindon has kindly suggested a number of times, you will need to post a sample workbook showing what you want the workbook to look like, for each of the conditions. I'm assuming that English may not be your primary language, and as a result we are struggling to comprehend the logic of your posts.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  14. #14
    you will need to post a sample workbook showing what you want the workbook to look like, for each of the conditions
    the result show on form , not inside sheet.
    as I mentioned the matter is relating with listbox2 as long depends on listbox1 , so no need show all of conditions in listbox1 because I would keep it.
    again new names should show in listbox2 as long are existed in first sheet, not existed in second sheet when collect balanced based on data in listbox1 this is based on post#10 for last picture and you can see inside sheet in post#12.

  15. #15
    VBAX Tutor
    Joined
    Jul 2005
    Posts
    209
    Location
    You said in post #1,
    I would add another condition to adjusting code for Private Sub GetData()........
    nothing about listbox2, and now
    you can keep all of cases in listbox1 as you writing is ok....
    but the problem will be in listbx2...
    So, there's no guarantee that you will change what you say.
    And you keep posting the same workbook...

    Now I see the reason why people would hegitate to respond you post even though the problem is not so complex.

    PLEASE ask some one else.

    I suggest you make yourself very clear before you ask, and don't change the question within the thread.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •