Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Storing a vba lookup in an array


Hi,

I would like to do the following:

From an array populated by country codes i would like to lookup the
country name in a named range on the form: CountryCode CountryName,
i.e. the second column. Then for each country code in the first array,
the found name should be stored in another array. Why wont this work
f.x.:

For i = 1 to whatever
CountryNames(i) = Application.Match(CountryCode(i),
CountryCodeArrayRange, 0).Offset(0, 1).Value
Next i

I might be making som "obvious" mistake, so please tell me if so!


--
erikhs
------------------------------------------------------------------------
erikhs's Profile: http://www.excelforum.com/member.php...o&userid=32788
View this thread: http://www.excelforum.com/showthread...hreadid=567054

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Storing a vba lookup in an array

Try:

For i = 1 to whatever
CountryNames(i) = Application.VLOOKUP(CountryCode(i),
CountryCodeArrayRange, 2,0)
Next i

HTH

"erikhs" wrote:


Hi,

I would like to do the following:

From an array populated by country codes i would like to lookup the
country name in a named range on the form: CountryCode CountryName,
i.e. the second column. Then for each country code in the first array,
the found name should be stored in another array. Why wont this work
f.x.:

For i = 1 to whatever
CountryNames(i) = Application.Match(CountryCode(i),
CountryCodeArrayRange, 0).Offset(0, 1).Value
Next i

I might be making som "obvious" mistake, so please tell me if so!


--
erikhs
------------------------------------------------------------------------
erikhs's Profile: http://www.excelforum.com/member.php...o&userid=32788
View this thread: http://www.excelforum.com/showthread...hreadid=567054


Reply
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
Use array for lookup value, to return array of lookups Glen Excel Discussion (Misc queries) 3 May 7th 09 11:55 PM
Storing an array in a cell Blue Max Excel Worksheet Functions 9 March 18th 09 12:54 PM
Lookup "greater than or equal to" in lookup array icemouse New Users to Excel 3 February 16th 06 10:07 PM
Storing text in an array Daniel Bonallack Excel Programming 9 December 14th 04 07:42 AM
storing financial data in array Fred[_19_] Excel Programming 1 September 13th 04 02:23 AM


All times are GMT +1. The time now is 04:15 PM.

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

About Us

"It's about Microsoft Excel"