H
h2fcell
I'm using the below code to populate the selected range with a vlookup.
Set Cherries = Worksheets("Main").Range("G559, K559, O559, S559, W559,
AA559, AE559, AI559, AM559, AQ559, AU559, AY559, BC559")
Set Pickles = Worksheets("Main").Range("G592, K592, O592, S592, W592, AA592,
AE592, AI592, AM592, AQ592, AU592, AY592, BC592")
Set Olives = Worksheets("Main").Range("G625, K625, O625, S625, W625, AA625,
AE625, AI625, AM625, AQ625, AU625, AY625, BC625")
Set Condiments = Worksheets("Main").Range("G658, K658, O658, S658, W658,
AA658, AE658, AI658, AM658, AQ658, AU658, AY658, BC658")
Set allProducts = Union(Cherries, Pickles, Olives, Condiments)
allProducts.Select
Selection.Value = "=VLOOKUP($B$1,Table2,Commission!C$1)"
The cells are populated with the vlookup but the column piece,
Commission!C$1, changes the same number of columns as the range selection
skips.
For instance I get:
G559 =VLOOKUP($B$1,Table2,Commission!C$1)
K559 =VLOOKUP($B$1,Table2,Commission!G$1)
O559 =VLOOKUP($B$1,Table2,Commission!K$1).....
What I need is:
G559 =VLOOKUP($B$1,Table2,Commission!C$1)
K559 =VLOOKUP($B$1,Table2,Commission!D$1)
O559 =VLOOKUP($B$1,Table2,Commission!E$1).....
or
G559 =VLOOKUP($B$1,Table2, 3)
K559 =VLOOKUP($B$1,Table2, 4)
O559 =VLOOKUP($B$1,Table2, 5).....
I'm not sure what I should use to accomplish this.
Any suggestions?
Thanks.
Set Cherries = Worksheets("Main").Range("G559, K559, O559, S559, W559,
AA559, AE559, AI559, AM559, AQ559, AU559, AY559, BC559")
Set Pickles = Worksheets("Main").Range("G592, K592, O592, S592, W592, AA592,
AE592, AI592, AM592, AQ592, AU592, AY592, BC592")
Set Olives = Worksheets("Main").Range("G625, K625, O625, S625, W625, AA625,
AE625, AI625, AM625, AQ625, AU625, AY625, BC625")
Set Condiments = Worksheets("Main").Range("G658, K658, O658, S658, W658,
AA658, AE658, AI658, AM658, AQ658, AU658, AY658, BC658")
Set allProducts = Union(Cherries, Pickles, Olives, Condiments)
allProducts.Select
Selection.Value = "=VLOOKUP($B$1,Table2,Commission!C$1)"
The cells are populated with the vlookup but the column piece,
Commission!C$1, changes the same number of columns as the range selection
skips.
For instance I get:
G559 =VLOOKUP($B$1,Table2,Commission!C$1)
K559 =VLOOKUP($B$1,Table2,Commission!G$1)
O559 =VLOOKUP($B$1,Table2,Commission!K$1).....
What I need is:
G559 =VLOOKUP($B$1,Table2,Commission!C$1)
K559 =VLOOKUP($B$1,Table2,Commission!D$1)
O559 =VLOOKUP($B$1,Table2,Commission!E$1).....
or
G559 =VLOOKUP($B$1,Table2, 3)
K559 =VLOOKUP($B$1,Table2, 4)
O559 =VLOOKUP($B$1,Table2, 5).....
I'm not sure what I should use to accomplish this.
Any suggestions?
Thanks.