D
DaveMoore
I am running excel2002 on Windows xp and dabbling in the writing of macros.
Can anyone tell me what is wrong with this?
'rem Copy the duplicated record to Archive and delete
Dim delcell As Range
Dim myRange As Range
Dim copyToRange As Range
Set copyToRange = Range("Archive!C12")
Set myRange = Range("dup")
Set delcell = myRange.Find(What:=1, LookIn:=xlValues, LookAt:=xlWhole)
If Not delcell Is Nothing Then
With delcell.EntireRow
Intersect(.Cells, Range("CC")).Copy Destination@ = copyToRange
.Delete
End With
End If
I get the following error message at the line that begins "Intersect..."
Run Time Error '1004'
Copy method of Range class failed.
Any help gratefully received
Dave Moore
Can anyone tell me what is wrong with this?
'rem Copy the duplicated record to Archive and delete
Dim delcell As Range
Dim myRange As Range
Dim copyToRange As Range
Set copyToRange = Range("Archive!C12")
Set myRange = Range("dup")
Set delcell = myRange.Find(What:=1, LookIn:=xlValues, LookAt:=xlWhole)
If Not delcell Is Nothing Then
With delcell.EntireRow
Intersect(.Cells, Range("CC")).Copy Destination@ = copyToRange
.Delete
End With
End If
I get the following error message at the line that begins "Intersect..."
Run Time Error '1004'
Copy method of Range class failed.
Any help gratefully received
Dave Moore