Copy / Paste without selecting sheet

LORDMARKS

New Member
Joined
Jun 5, 2014
Messages
39
Code:
Sheets("Sheet1").Range("B23:D37").ClearContents
Sheets("Sheet1").Range("B4:D18").SpecialCells(xlCellTypeVisible).Copy Destination:=Sheets("Sheet1").Range("B23:D37")
Sheets("Sheet1").Range("B23:D37").Value = Sheets("Sheet1").Range("B23:D37").Value

The above code works fine when I only select one filter variable, however when I select from another column I get the same data repeated all the way down the target range?

What I am trying to do is clean up some slow recorded macros, given to me on an old workbook. So I am trying to remove all the copy / paste functions and repeat codes. This seemed to be the most efficient way of moving selected data to another sheet so that I could run reports. If anyone has any idea why this doesnt work or can offer a better solution, that would be great.

cheers all
 

Some videos you may like

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Watch MrExcel Video

Forum statistics

Threads
1,123,259
Messages
5,600,575
Members
414,390
Latest member
plimbu

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
Top