Excel VBA to Create and Autofill New Table Part 2

Slazar

New Member
Joined
Aug 28, 2015
Messages
17
Hi all,

Please help!
I need a macro that does the following:

User will input the information in the table below.

User will then click a button tied to the macro. The macro will return the filled out table in a newly created sheet.
For the table created by the macro, the cells will need to have all borders filled.

Example:

Apple is a Fruit. For Apples, there are two cooking methods (Bake and Fry) with associated pictures 1 and 2 (which are links to another sheet displaying the photo). Part of the outputted table will display all cooking methods, with all associate pictures, for all apples inputted from the user. So it shows the cooking methods for Green Apple and for Red Apple. The outputted table will have empty columns for comments and updates.


Input from User:

[TABLE="width: 500"]
<tbody>[TR]
[TD="align: center"][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C
[/TD]
[/TR]
[TR]
[TD="align: center"]1
[/TD]
[TD="align: center"]Category[/TD]
[TD="align: center"]Type[/TD]
[TD="align: center"]Color (ID)[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]Fruit
[/TD]
[TD="align: center"]Apple[/TD]
[TD="align: center"]Red[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]Fruit[/TD]
[TD="align: center"]Apple[/TD]
[TD="align: center"]Green[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]Vegetable[/TD]
[TD="align: center"]Broccoli[/TD]
[TD="align: center"]Green[/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD="align: center"]Vegetable[/TD]
[TD="align: center"]Broccoli[/TD]
[TD="align: center"]Purple[/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD="align: center"]Meat[/TD]
[TD="align: center"]Chicken[/TD]
[TD="align: center"]White[/TD]
[/TR]
</tbody>[/TABLE]



User then Clicks Button

Hidden Table Already Filled Out in Another Sheet:
[TABLE="width: 500"]
<tbody>[TR]
[TD="align: center"][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[/TR]
[TR]
[TD="align: center"]1
[/TD]
[TD="align: center"]Category[/TD]
[TD="align: center"]Type[/TD]
[TD="align: center"]Cooking Method[/TD]
[TD="align: center"]Picture[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]Fruit[/TD]
[TD="align: center"]Apple[/TD]
[TD="align: center"]Bake[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]Fruit[/TD]
[TD="align: center"]Apple[/TD]
[TD="align: center"]Fry[/TD]
[TD="align: center"]2[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]Vegetable[/TD]
[TD="align: center"]Broccoli[/TD]
[TD="align: center"]Bake[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD="align: center"]Vegetable[/TD]
[TD="align: center"]Broccoli[/TD]
[TD="align: center"]Steam[/TD]
[TD="align: center"]4[/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD="align: center"]Vegetable[/TD]
[TD="align: center"]Broccoli[/TD]
[TD="align: center"]Microwave[/TD]
[TD="align: center"]5[/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD="align: center"]Meat[/TD]
[TD="align: center"]Chicken[/TD]
[TD="align: center"]Bake[/TD]
[TD="align: center"]6[/TD]
[/TR]
[TR]
[TD="align: center"]8[/TD]
[TD="align: center"]Meat[/TD]
[TD="align: center"]Chicken[/TD]
[TD="align: center"]Grill[/TD]
[TD="align: center"]7[/TD]
[/TR]
[TR]
[TD="align: center"]9[/TD]
[TD="align: center"]Meat[/TD]
[TD="align: center"]Chicken[/TD]
[TD="align: center"]Fry[/TD]
[TD="align: center"]8[/TD]
[/TR]
</tbody>[/TABLE]



Output from Macro in Newly Created Sheet:
[TABLE="width: 500"]
<tbody>[TR]
[TD="align: center"][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[TD="align: center"]E[/TD]
[TD="align: center"]F[/TD]
[TD="align: center"]G[/TD]
[TD="align: center"]H[/TD]
[/TR]
[TR]
[TD="align: center"]1[/TD]
[TD="align: center"]Item #[/TD]
[TD="align: center"]Category[/TD]
[TD="align: center"]Type[/TD]
[TD="align: center"]Color (ID)[/TD]
[TD="align: center"]Cooking Method[/TD]
[TD="align: center"]Updates[/TD]
[TD="align: center"]Comments[/TD]
[TD="align: center"]Picture[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]Fruit[/TD]
[TD="align: center"]Apple[/TD]
[TD="align: center"]Red[/TD]
[TD="align: center"]Bake[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]Fruit[/TD]
[TD="align: center"]Apple[/TD]
[TD="align: center"]Red[/TD]
[TD="align: center"]Fry[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]2[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]3[/TD]
[TD="align: center"]Fruit[/TD]
[TD="align: center"]Apple[/TD]
[TD="align: center"]Green[/TD]
[TD="align: center"]Bake[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]Fruit[/TD]
[TD="align: center"]Apple[/TD]
[TD="align: center"]Green[/TD]
[TD="align: center"]Fry[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]2[/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]Vegetable[/TD]
[TD="align: center"]Broccoli[/TD]
[TD="align: center"]Green[/TD]
[TD="align: center"]Bake[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD="align: center"]6[/TD]
[TD="align: center"]Vegetable[/TD]
[TD="align: center"]Broccoli[/TD]
[TD="align: center"]Green[/TD]
[TD="align: center"]Steam[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]4[/TD]
[/TR]
[TR]
[TD="align: center"]8[/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]Vegetable[/TD]
[TD="align: center"]Broccoli[/TD]
[TD="align: center"]Green[/TD]
[TD="align: center"]Microwave[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]5[/TD]
[/TR]
[TR]
[TD="align: center"]9[/TD]
[TD="align: center"]8[/TD]
[TD="align: center"]Vegetable[/TD]
[TD="align: center"]Broccoli[/TD]
[TD="align: center"]Purple[/TD]
[TD="align: center"]Bake[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD="align: center"]10[/TD]
[TD="align: center"]9[/TD]
[TD="align: center"]Vegetable[/TD]
[TD="align: center"]Broccoli[/TD]
[TD="align: center"]Purple[/TD]
[TD="align: center"]Steam[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]4[/TD]
[/TR]
[TR]
[TD="align: center"]11[/TD]
[TD="align: center"]10[/TD]
[TD="align: center"]Vegetable[/TD]
[TD="align: center"]Broccoli[/TD]
[TD="align: center"]Purple[/TD]
[TD="align: center"]Microwave[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]5[/TD]
[/TR]
[TR]
[TD="align: center"]12[/TD]
[TD="align: center"]11[/TD]
[TD="align: center"]Meat[/TD]
[TD="align: center"]Chicken[/TD]
[TD="align: center"]White[/TD]
[TD="align: center"]Bake[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]6[/TD]
[/TR]
[TR]
[TD="align: center"]13[/TD]
[TD="align: center"]12[/TD]
[TD="align: center"]Meat[/TD]
[TD="align: center"]Chicken[/TD]
[TD="align: center"]White[/TD]
[TD="align: center"]Grill[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]7[/TD]
[/TR]
[TR]
[TD="align: center"]14[/TD]
[TD="align: center"]13[/TD]
[TD="align: center"]Meat[/TD]
[TD="align: center"]Chicken[/TD]
[TD="align: center"]White[/TD]
[TD="align: center"]Fry[/TD]
[TD="align: center"][/TD]
[TD="align: center"][/TD]
[TD="align: center"]8[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Can anyone help with this macro? I tried to take a similar macro and edit it but I can't seem to figure it out.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,327
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top