Add new vaue to a different sheet
Hi Helmekki,
Just a typo warning:
Set exp = Sheet1.Range("B2:B52")
Set myRng = Sheet2.Range("B2:B52")
In the above expressions, B52 should read B50, of course!
---
Regards,
Norman
"Norman Jones" wrote in message
...
Hi Helmekki,
Try:
Sub AdNwExp()
Dim myRng, cel, exp As Range
Dim destCell As Range
Set exp = Sheet1.Range("B2:B52")
Set myRng = Sheet2.Range("B2:B52")
On Error GoTo XIT
For Each cel In exp.Cells
If IsEmpty(cel) Then Exit For
With Application
.ScreenUpdating = False
If IsError(.Match(cel.Value, myRng, 0)) Then
If .CountA(myRng) = 0 Then
Set destCell = myRng(1)
ElseIf .CountA(myRng) = 1 Then
Set destCell = myRng(2)
Else
Set destCell = myRng(1).End(xlDown). _
Offset(1)
End If
cel.Copy destCell
End If
End With
Next
XIT:
Application.ScreenUpdating = True
End Sub
---
Regards,
Norman
|