inserting data into specific cell in table based on relative data in table using vb code

  • I am working on creating a new budget tracking sheet for my department.

    currently I have a Macro that adds my req number and all the other data seen in first photo. what I am trying to accomplish is adding the PO number in next to the req number it's related to.

    so I have a user form with a dropdown list that has all the req numbers. then I have the PO field and the date entered field that i want to enter into the table where ever the req number selected in the list is

  • To make things easier ... why don't you attach a sample file ...:)

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • sorry not sure why I didn't think of that earlier.


    I appreciate all the input and help I can get with this.


    I have no training in this and I am self taught. I am very green to this so as much detail and explanation as possible will make me better.


    again thank you to anyone and everyone for the help

  • Hello,


    Thanks for your sample file ...


    Now... let me list all my guesses :


    1. You need to code your UserForm AddPoFrm

    2. Based on a ' future ' Req number located in Column L on your sheet Parts List, you want to to add a ' future ' PO Number

    3. the macro has to locate where the Req number appears in order to save the PO Number next to it ...


    Is that right ...????

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • So among the solutions ... you could use AutoFilter ...


    Code
    Sub AddPONumb()
        Sheet3.ListObjects("PartsTbl").Range.AutoFilter Field:=12, Criteria1:="yourReqNumb"
        Sheet3.Range("M3:M52").SpecialCells(xlCellTypeVisible).Value = yourPONumber
    End Sub

    Hope this will help

    :)

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • From a UserForm ... you should be testing the following :


    Hope this will help

    :)

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Thanks for your Like :thumbup:

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Obviously .... I cannot see what is in front of your own eyes ...


    Have to assume at least ... the following things :


    1. your worksheet Parts List is indeed filled with records ...

    2. your worksheet Parts List ... the Filter is on

    3. the "Req" number you have typed in your UserForm in the field ReqList is actually present in Column L of your sheet ...

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Hello,


    At my end cannot test your file since "UniqueReq" does not load and UserForm cannot be displayed ...:(


    By the way ... whenever you see a dropdown arrow next to your Headers ... it does mean your Filter is On ...;)

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • HUH...why will "UniqueReq" not load? formula for this is located on the Formulas sheet and why can the userform not display...i could be just dumb8o

    For a specific reason ... you are working with Microsoft 365 ... and the ultra-latest-most-updated-sophisticated Formulas ...!!!:):):)

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Hello again,


    Could you test the macro posted in message # 8 ... with actual real-life data for the Req Number and the PO number ...


    thus ... by passing the UserForm ...;)

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!