Is this code correct?

andonny

Board Regular
Joined
Mar 11, 2002
Messages
220
Hi,
I was just wondering if all the code below is correct.I was trying to add the find option to it and it leaves funny black cells behind. Never seen this before happening. It seems to copy correctly though.


Thanks a million
Anndonny


Dim rng As Range
Dim rng_find As Range
Set rng_find = Workbooks("Test1.xls").Worksheets("Sheet1").Range("A1:A65000").Find(what:="RedLine")
With Workbooks("Test2.xls").Worksheets("Sheet1")
' periods in front of all references except rng
Set rng = .Range(.Range("A2"), .Range("G2").End(xlDown))
End With
rng.Copy Destination:=rng_find.Offset(1, 0)
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Andonny

I don't know what you mean by leaves funny black cells behind, but the code seems to work. If, somewhere in your original code, you are selecting before copying or pasting, the black cells could just be the selected cells.

If that is not the case, you may like to post the full code.

Any help?

Regards

Robb__
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,843
Members
449,051
Latest member
excelquestion515

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top