#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 205
Default Lookup List

Hi,

I need to run a bit of code that will run through a range in a workbook and
check if there are any values (strings) that do not appear in a checklist
(one column of data) in another open workbook. So far I happy with get it
to run through the first range cell by cell but I'm a bit stuck with the
best way of getting it to check the reference list in the other workbook.
Can anyone help?

The reference list is about 700 records long, just for your information and
the reason that I'd like it to be in a separate sheet is that I need to run
this procedure on a number of workbooks.

Thanks in advance.

John


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Lookup List


Try (untested):

Sub Test()

Dim rCheck As Range
Dim rValue As Range
Dim bFound As Boolean

For Each rValue In Sheets("Sheet1").Range("A1:A10")
bFound = False
For Each rCheck I
Workbooks("Checklist.xls").Sheets("Checksheet").Ra nge("A1:A700")
If rCheck.Value = rValue.Value Then
bFound = True
Exit For
End If
Next
If bFound = False Then
MsgBox rValue.Value & " was not found."
End If
Next

End Sub

Substituing the checklist workbook, worksheet and range fo
Checklist.xls, Checksheet and A1:A700 and the sheet, range to check fo
Sheet1 and A1:A10.



--
kkkni
-----------------------------------------------------------------------
kkknie's Profile: http://www.excelforum.com/member.php...nfo&userid=754
View this thread: http://www.excelforum.com/showthread.php?threadid=26694

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 205
Default Lookup List

Hi K!

Thanks very much for the code. I've ended up using the middle For..Each
code and it works perfectly.

Is it a very different kettle of fish if you're trying to access a closed
workbook?

Anyway, thanks again.

Best regards

John
"kkknie" wrote in message
...

Try (untested):

Sub Test()

Dim rCheck As Range
Dim rValue As Range
Dim bFound As Boolean

For Each rValue In Sheets("Sheet1").Range("A1:A10")
bFound = False
For Each rCheck In
Workbooks("Checklist.xls").Sheets("Checksheet").Ra nge("A1:A700")
If rCheck.Value = rValue.Value Then
bFound = True
Exit For
End If
Next
If bFound = False Then
MsgBox rValue.Value & " was not found."
End If
Next

End Sub

Substituing the checklist workbook, worksheet and range for
Checklist.xls, Checksheet and A1:A700 and the sheet, range to check for
Sheet1 and A1:A10.

K


--
kkknie
------------------------------------------------------------------------
kkknie's Profile:

http://www.excelforum.com/member.php...fo&userid=7543
View this thread: http://www.excelforum.com/showthread...hreadid=266945



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Lookup List


I believe you will have to open them first. Heres a link with
solution to move sheets from one workbook to another. You can probabl
adapt it to do what you want.

http://www.mrexcel.com/board2/viewtopic.php?t=83630



--
kkkni
-----------------------------------------------------------------------
kkknie's Profile: http://www.excelforum.com/member.php...nfo&userid=754
View this thread: http://www.excelforum.com/showthread.php?threadid=26694

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 205
Default Lookup List

That's great K. Thanks for your help.

John
"kkknie" wrote in message
...

I believe you will have to open them first. Heres a link with a
solution to move sheets from one workbook to another. You can probably
adapt it to do what you want.

http://www.mrexcel.com/board2/viewtopic.php?t=83630

K


--
kkknie
------------------------------------------------------------------------
kkknie's Profile:

http://www.excelforum.com/member.php...fo&userid=7543
View this thread: http://www.excelforum.com/showthread...hreadid=266945



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
List Lookup Help nabanco Excel Worksheet Functions 6 September 29th 07 03:54 PM
LOOKUP/List Help diver_sol Excel Discussion (Misc queries) 9 May 14th 07 03:23 PM
Join 2 Lists - Lookup value in 1 list & use result in 2nd lookup JBush Excel Worksheet Functions 3 January 3rd 07 11:14 PM
Lookup the last occurance of a value in a list Nav Excel Discussion (Misc queries) 6 September 8th 06 01:15 PM
Lookup and list Voodoodan Excel Discussion (Misc queries) 5 May 25th 06 07:07 PM


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