Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have two Workbooks Test1 ( the m

Status
Not open for further replies.

lizI3

Programmer
Jul 2, 2002
31
0
0
CA
I have two Workbooks Test1 ( the master file) and Test2(for an individuals use) . I have a macro that will copy all files in test1 that is for "LIZ" to Test2 This is my code
Dim x As Integer
Workbooks.Open Filename:= _
"test2.xls"
Windows("test1.xls").Activate
For Each cell In Range("i1", Range("i2").End(xlDown))
x = x + 1
If Range("I" & x).Value = "" Then Exit For
If Range("I" & x).Value = "Liz" Then
Range("i" & x).EntireRow.Copy

Windows("test2.xls").Activate
Range("A65536").End(xlUp).Offset(1, 0).Select
ActiveCell.PasteSpecial (xlPasteValues)
Windows("test1.xls").Activate
End If
Next cell
Workbooks("Test2.XLS").Close SaveChanges:=True
Application.CutCopyMode = False

But fefore it paste the records to test2 I want it to check to see it that record number (ie 15) is already in Test2 if so replace it with the new one. If not just copy the new on
into test2.

How could I do this ?
Thanks
Liz



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top