Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Xlookup between two tables

0

Greetings, I would be very grateful if you could give me some idea, you will see I am trying to develop a code that allows me, through a macro, to apply the XLookUp function to compare two tables (TABLE1 AND TABLE1) and enter, according to their ID, the weight and the cost of the products in the second table and after leaving the "TABLE1" clean to be filled again,((𝐀𝐁𝐋𝐄 𝐂𝐀𝐍 π†πŽπ– 𝐎𝐍 πˆπƒ π‚πŽπƒπ„ π…πŽ ππŽπƒπ‚)) I'm starting with Vba and I can't get much further than the Dim and the Set, I'm trying to declare the function with Listobjects.ListColumns. DataBody.Range and the function does not accept the range thanks for what you can contribute...

Answer
Discuss

Discussion

Hi Kapela and welcome to the Forum.

Sorry but your question isn't clear (e.g it has the same name for both tables), nor is the outcome- it seems one table is cleared but how is the second table changed?

Please edit your question and use the Add Files... button to upload a representative Excel file (without any personal data) to show your existing macro and data. Then weΒ may be able to give specific help.
John_Ru (rep: 4312) Nov 4, '22 at 2:33 pm
Hello I am very grateful that you take some time I just graduated from university, and I do not have much experience in Vba, you will see the first table is populated by entering a listbox, I did some calculations in it and then I enter them in the second table for Inventory Control (How many products are left in the warehouse) once copied I need to leave the first table without data to perform the operation once more and the second table must be left with the information added the names are Tabal1 and Table2 , all this I would like to do through the XLookup function thanks for your grateful help
Kapela Nov 4, '22 at 5:22 pm
Kapela

Thanks for appending your comments to this Discussion (you now need to delete the Answer).

It would really help if you attach a file to your original Question, with some sample data (no need for the real stock details).

You're being quite ambitious witha first project in VBA (though most things are possibe). I'm not sure why you're using XLOOKUP (other than to match the items) and how you want to update Table 2- is your manager happy if your table just shows what the balance of stock is (with no detail of how it changed)?. ManyΒ inventory control systems keep records of the individual stock movements (so there's a history) - in that case it might be better to copy over the Table1 entries, sort them with existing data then use the SUBTOTAL function. Please clarify (again, in your Question so other contributors might see the full question without drilling down the Discussion).
John_Ru (rep: 4312) Nov 5, '22 at 5:12 am
Add to Discussion

Answers

0

Hello I am very grateful that you take some time I just graduated from university, and I do not have much experience in Vba, you will see the first table is populated by entering a listbox, I did some calculations in it and then I enter them in the second table for Inventory Control (How many products are left in the warehouse) once copied I need to leave the first table without data to perform the operation once more and the second table must be left with the information added the names are Tabal1 and Table2 , all this I would like to do through the XLookup function thanks for your grateful help

Discuss

Discussion

Kapela

Firstly please note that your comments above should be used to midify your original question or under my Discussion point, not as an Answer. In this Forum, Answers should be reserved for solutions.

Secondly we cannot "see" what you are trying until you attach a file to your question and/or explain fully in the question text.
John_Ru (rep: 4312) Nov 4, '22 at 6:24 pm
Add to Discussion


Answer the Question

You must create an account to use the forum. Create an Account or Login