LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Array Code issue

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.
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Complex Array sorting issue Tubster Excel Worksheet Functions 5 July 10th 08 11:38 PM
Issue with array [email protected] Excel Discussion (Misc queries) 2 April 20th 07 01:50 PM
Array constant issue Sige Excel Worksheet Functions 16 March 16th 06 02:56 PM
Help with complex index array issue kkendall Excel Worksheet Functions 4 August 5th 05 10:15 PM
Tricky array formula issue - Using array formula on one cell, then autofilling down a range aspenbordr Excel Programming 0 July 27th 05 03:59 PM


All times are GMT +1. The time now is 05:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"