Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Looking for range values in another range/sheet

Hi,
I've got following situation. I've got 2 sheets and I want to find
these rows in Sheet1, which contains values from Sheet 2 (2 cells in
row only). My idea is to first loop through rows in Sheet1 and inside
this loop have another loop through range from Sheet2. The problem is
how to read values from rows in Sheet2 to compare them with cells
values from Sheet1.

TIA

Przemek

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Looking for range values in another range/sheet

Dim cell as Range, cell1 as Range, rw as Range
for each cell in Worksheets("Sheet1").Range("A1:A10")
if application.Countif(Worksheets("Sheet2").Range("B9 :F32"),cell.Value)
0 then
' a match exists, find it
for each rw in Worksheets("Sheet2").Range("B9:F32")
for each cell1 in rw.cells
if cell.value = cell1.value then
msgbox "Found at " & cell1.Address(0,0,xlA1,True)
end if
Next
Next
End if
Next

There are faster ways, but this does looping similar to your suggestion

--
Regards,
Tom Ogilvy


"Przemek" wrote in message
oups.com...
Hi,
I've got following situation. I've got 2 sheets and I want to find
these rows in Sheet1, which contains values from Sheet 2 (2 cells in
row only). My idea is to first loop through rows in Sheet1 and inside
this loop have another loop through range from Sheet2. The problem is
how to read values from rows in Sheet2 to compare them with cells
values from Sheet1.

TIA

Przemek



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
SUMPRODUCT or SUMIF if any values in a range equal any values in another range PCLIVE Excel Worksheet Functions 3 July 15th 09 07:43 PM
Make all values of a 3D named range appear on summary sheet Joe L Excel Discussion (Misc queries) 1 April 14th 09 10:33 PM
Paste range of values into filtered sheet ken2005 Excel Discussion (Misc queries) 3 October 3rd 05 11:22 AM
Placing values in a range on a non-active sheet Daniel Bonallack Excel Programming 3 May 9th 05 06:18 PM
Copying a particular range of values from one sheet to another in excel anoop_2000 Excel Programming 2 June 17th 04 03:46 AM


All times are GMT +1. The time now is 11:18 AM.

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"