View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Carlos Carlos is offline
external usenet poster
 
Posts: 84
Default Loop find between worksheets

Hi Again,

Ignore my other post, I've just gone through all your coding and understood
everything. The reason mine wasn't working is I was using Sheet 1 column B,
Sheet 2 colmn H. Testing it looks good. The one thing I need to change is I
need
to move over more then the value it's found. So I'm going to play around
with this line

sh1.Range("H" & lr1 + 1) = c.Value

Thansk again for you help, I'm still learning and when people help with
codes like this it really does further my knowledge.

Best regards
Carl
"JLGWhiz" wrote:

This tested OK in my set up, but try it on a copy before you run it on your
original.

Sub moveOver()
Dim lr1 As Long, lr2 As Long
Dim sh1 As Worksheet, sh2 As Worksheet
Set sh1 = ActiveWorkbook.Sheets("Sheet1")
Set sh2 = ActiveWorkbook.Sheets("Sheet2")
lr2 = sh2.Cells(Rows.Count, 2).End(xlUp).Row
For Each c In sh2.Range("B1:B" & lr2)
lr1 = sh1.Cells(Rows.Count, 8).End(xlUp).Row
If WorksheetFunction.CountIf _
(sh1.Range("H1:H" & lr1), c.Value) = 0 Then
sh1.Range("H" & lr1 + 1) = c.Value
End If
Next
End Sub




"Carlos" wrote in message
...
Hi,

I've a range of data in Sheet 1 in column H1-500. I've used a vlookup to
take information from Sheet 2 matching H1-500 to Column B1-700 and
returning
a result in Sheet 1 . What I want to do is identify the data that isn't
found
from this Vlookup and add it to the list in Sheet 1

So basically in sheet 2 take the first number in the row (b1) search
H1-500
in sheet 1. If it's doent' find it- Copy and paste the row to end of Sheet
1.
(row 501)

Then move to next row in sheet 2 (b2) to do the same search again.

I would like to attempt this myself, but I'm so limited on time I can't
even
think where to start.

Any help please?

Carl