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: 2
Default VBA Lookup with Find method

Hi all,

I want to do a lookup in VBA to find the appropriate region for a
given country. They way I want to do is to loop through the country
column for all rows in my database sheet. For each country, find this
country on my Settings sheet, offset this cell by one column to get
the region. Finally paste the region one cell to the right of the
country cell in the database.

As I potentially could have the country names in several times on the
settings sheet, I only want to search in a specific range (i.e. where
I have countries in column 1 and regions in column 2).

I can't get the find method to work for only a specific range. What am
I doing wrong? (I have tried to include the settings sheet etc...)

The code looks like this:

For Count = 1 To LastRow

Country = WorkRange.Offset(Count, 0).Value

Set rTemp = LookupRange.Find(What:=Country, After:=[A1],
LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByRows,
SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)

[more code]

Next count


Many thanks,
Oscar
 
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
xls vba find method to find row that contains the current date RCranston Excel Programming 3 March 28th 07 03:59 PM
date find using find method x taol Excel Programming 2 December 22nd 05 09:51 AM
Using variables to make a date and using find method to find that. KyWilde Excel Programming 2 April 21st 05 09:43 PM
find method? CG Rosén Excel Programming 2 November 12th 03 10:30 AM
The find method Stuart[_6_] Excel Programming 0 August 5th 03 03:14 PM


All times are GMT +1. The time now is 04:45 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"