+ Reply to Thread
Results 1 to 9 of 9

Load Data Form Table to Order Form Using VLookUp in VBA

  1. #1
    Registered User
    Join Date
    02-02-2022
    Location
    New York
    MS-Off Ver
    365
    Posts
    5

    Load Data Form Table to Order Form Using VLookUp in VBA

    I have the code below which I am having trouble with. I am trying to load data from a Order_Table to an Order_Form using vlookup. I am using vlookup vba and copy and paster. Vlookup is contingent on order number input. I have attached the file.


    Sub Load_Order()


    Dim rng As Range
    Dim temp As Variant
    Dim i As Long
    Dim a As Long
    Dim rng_dest As Range
    Dim Order_Number As String
    Order_Number = Order_Form.cell("C_5")

    'Order_Number = InputBox("Enter Order Number :")

    If IsEmpty(Range("C5").Value) = True Then
    MsgBox "Cell C5 is empty"

    Else

    Order_Form.cell("C5") = Application.WorksheetFunction.VLookup(Order_Number, ORDER_TABLE.Range("B6:B9"), 1, False)


    ' Date
    Worksheets("ORDER_TABLE").Range("C6").Copy
    Worksheets("ORDER_FORM").Range("B8" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues



    End If



    End Sub


    ORDER # ITEM DESCRIPTION QTY
    101 9987 White T-Shirt 5
    102 4286 Red T-Shirt 7
    103 2938 Green T-Shirt 8
    104 9257 Yellow T-Shirt 3


    Order# 101

    ORDER # ITEM DESCRIPTION QTY
    Attached Files Attached Files

  2. #2
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: Load Data Form Table to Order Form Using VLookUp in VBA

    Although I am not sure what exactly you're looking for and why, but based on the code you shared I think you're trying to do this -

    Please Login or Register  to view this content.
    Happy to Help

    How to upload excel workbooks at this forum - http://www.excelforum.com/the-water-...his-forum.html

    "I don't get things easily, so please be precise and elaborate"

    If someone's post has helped you, thank by clicking on "Add Reputation" below the post.
    If your query is resolved please mark the thread as "Solved" from the "Thread Tools" above.

    Sourabh

  3. #3
    Registered User
    Join Date
    02-02-2022
    Location
    New York
    MS-Off Ver
    365
    Posts
    5

    Re: Load Data Form Table to Order Form Using VLookUp in VBA

    Hi Sourabhm

    This is what I am trying to accomplish, but my actual data will not be placed in a row; for example, I will copy and paste random cells in the table to random cells on the form. I created a simple example, but the original code I wrote would have copied select or randoms and copied them to select or random cells. I think the code would look different.

    Thank you for getting back to me so quickly.


    I this modifiable?

    Ivy_1011
    Last edited by Ivy_1011; 02-02-2022 at 04:25 PM.

  4. #4
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: Load Data Form Table to Order Form Using VLookUp in VBA

    Sorry, I didn't really understand what you're trying to accomplish here. It might be easier if you can share another example with the results that you need manually typed in so I can replicate the same.

  5. #5
    Registered User
    Join Date
    02-02-2022
    Location
    New York
    MS-Off Ver
    365
    Posts
    5

    Re: Load Data Form Table to Order Form Using VLookUp in VBA

    Okay, thank you.

  6. #6
    Registered User
    Join Date
    02-02-2022
    Location
    New York
    MS-Off Ver
    365
    Posts
    5

    Re: Load Data Form Table to Order Form Using VLookUp in VBA

    Hi Sourabhg98,

    I have uploaded a revised spreadsheet. Hopefully, my objective will be more clear.


    Thanks.

    Ivy_1011
    Attached Files Attached Files

  7. #7
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: Load Data Form Table to Order Form Using VLookUp in VBA

    Does this work?

    Also, not sure but why are doing this via VBA and not formulas?
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    02-02-2022
    Location
    New York
    MS-Off Ver
    365
    Posts
    5

    Re: Load Data Form Table to Order Form Using VLookUp in VBA

    Hi Sourabhg98,

    This is very close to what I am looking for. The original file is more complex which is why it's not being done with formulas; orders are input into the order form, cleared, and loaded if necessary.

    Thank you this was extremely helpful!,

    Regards,
    Ivy_1011
    Last edited by Ivy_1011; 02-02-2022 at 07:11 PM.

  9. #9
    Forum Expert sourabhg98's Avatar
    Join Date
    10-22-2014
    Location
    New Delhi, India
    MS-Off Ver
    Excel 2007, 2013
    Posts
    1,899

    Re: Load Data Form Table to Order Form Using VLookUp in VBA

    Glad I could assist. If your query is resolved please mark the thread as "Solved" from the "Thread Tools" above.

+ 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. Replies: 13
    Last Post: 06-08-2018, 06:50 AM
  2. Alternative to VLOOKUP when data is in min/ max (i.e. 0-5) form vs. table form
    By kelseygueldalewis in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-23-2017, 10:58 AM
  3. Want to auto-populate an order form from a storeroom count form
    By bezam in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-17-2014, 09:02 PM
  4. How to use Vlookup or If fuction to create an order form.
    By 08swifty1988 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-07-2013, 06:03 PM
  5. Order form Vlookup
    By Log010 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-13-2011, 07:41 PM
  6. Form not displaying cell data on load.
    By vaximily in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-09-2011, 06:00 PM
  7. Form Load Picture form variable
    By D_Rennie in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 06-21-2009, 12:02 PM

Tags for this Thread

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