VBA Beginner Question

Final Frontier

New Member
Joined
Sep 16, 2014
Messages
17
I’ve worked with simple macros but am wondering if something more complex is possible (this actually might be simple as well).

I have a set of data with item numbers, quantity, price, and account numbers. The letters in the first row are the columns. Example below:

Tab 1
A
B
C
D
E
Account 1
Item number
Account 2
Quantity
Price
202
11
102
6
100
203
22
103
7
200
204
33
104
10
300
205
44
105
30
400
206
55
106
5
500

<tbody>
</tbody>

And then on a second tab I have data with a percentage that is supposed to go to each person:

Tab 2
A
B
C
D
E
F
G
H
I
location
State
Zip
%
NAME ID
Name
Account 3
Account 4
ID
New York
NY

30%
A
Jon
101
201
E
Pittsburgh
PA

30%
B
Mike
201
202
F
Dallas
TX

40%
C
Adam
301
203
J

<tbody>
</tbody>

There’s a third tab where the final information needs to be. Essentially what needs to happen is each person will get a percentage of each line from tab 1. So for the first line in tab 1, Jon will get 30% of the quantity and price, Mike 30%, and Adam 40%. This will need to be done for each line in tab 1. So for example the final product for the first line should look like this:

A
B
C
D
E
F
G
H
Blank
Item
Quantity
Sales
Account 1
Account 2
Account 3
Account 4

11
1.8
30
202
102
101
201

11
1.8
30
202
102
201
202

11
2.4
40
202
102
301
203

<tbody>
</tbody>

The data I have is much larger so I was hoping someone could direct me of how to write a macro for this. I’m stuck on how to do this and am admittedly still learning the basics of vba. Is there a way you can write a code that can take data from each heading and multiply by a percentage, and then also carry over the item numbers and accounts?

Any help would be appreciated. Even if you can just direct me to different functions or the general process to use. Thanks in advance.
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Forum statistics

Threads
1,215,065
Messages
6,122,944
Members
449,095
Latest member
nmaske

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