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

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
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,666
Messages
6,120,806
Members
448,990
Latest member
rohitsomani

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