Posted to microsoft.public.excel.programming
|
|
Add new vaue to a different sheet
Hi Bill,
Look at VBA's help on WorkSheetFunction.
---
Regards,
Norman
"William Benson" wrote in message
...
Norman,
Any idea why I cannot find .Match as a documented method of the
Application object in Microsoft VBA Help? It seems to work perfectly, and
I wanted to learn about its arguments.
Thanks.
"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
"helmekki" wrote
in message ...
Hi there
'* The code confirms that each value in sheet1 exist in sheet2.
'* I need if the code finds a new value in sheet1 to put it in sheet2
last value..............
This code is my try, but cannot perform the job needed
Code:
--------------------
Sub AdNwExp()
Dim counter As Integer
Dim myRng, cel, exp As Range
counter = 1
Do
Set exp = Sheet1.Range("B2:B50")
Set myRng = Sheet2.Range("B2:B50").Cells(counter, 1)
For Each cel In exp
If cel = myRng Then GoTo 1
Next cel
1:
counter = counter + 1
Loop Until IsEmpty(exp)
End Sub
--------------------
--
helmekki
------------------------------------------------------------------------
helmekki's Profile:
http://www.excelforum.com/member.php...fo&userid=6939
View this thread:
http://www.excelforum.com/showthread...hreadid=384097
|