What's wrong with this vb?

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("C:DC")).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
 
B

Bob Phillips

Try

Intersect(.Cells, Range("C:DC")).Copy Destination:=copyToRange


--

HTH

RP
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top