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

Hi,
Thanks for spending the time on this! It's very appriciated as I'll need to
do this everymonth to the same sheet so would be good to get this tied down.

I've tried this is a test page, but it doesn't seem to do anything? It runs
through the macro ok without any errors?

Any Ideas? I just copied the code straight down. (my test code is the list
in column B on sheet 1 and list in column H on sheet 2) when I run the match
values on sheet2 there are N/A errors so some don't match.

Thanks
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