A better way to copy-paste code

pincivma

Board Regular
Joined
Dec 12, 2004
Messages
206
Hi there

Below is my code. It is very simplistic since I recorded the macro. It copies everything, text, numbers, formulas, dropdown boxes etc from one workbook to another. This code works well. Is there a better code I can use? I have many worksheets to copy over from one workbook to another

Application.DisplayAlerts = False
Application.EnableEvents = False
Windows("Quote Transporter.xlsm").Activate
Sheets("Video").Select
Range("B9:H461").Select
Selection.Copy
Windows("NEW Sales Quote Tool USER version 01-191.xlsm").Activate
Sheets("Video").Select
Range("B9").Select
ActiveSheet.Paste

I tried the following code below but it does not transfer any data.

Workbooks("NEW Sales Quote Tool USER version 01-191.xlsm").Worksheets("Video").Range("B9:H461) = Workbooks("Quote Transporter.xlsm").Worksheets("Video").Range("B9:H461")
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Code:
[COLOR=#333333]Workbooks("NEW Sales Quote Tool USER version 01-191.xlsm").Worksheets("Video").Range("B9:H461) = Workbooks("Quote Transporter.xlsm").Worksheets("Video").Range("B9:H461").Value[/COLOR]
 
Upvote 0
Hi Footoo

Thanks for the code. Your code does not carry formulas across. What it does is it turns the formulas into values and I don't want that. I want the formulas to come across as fomulas.
 
Upvote 0
Maybe....

Code:
    Application.ScreenUpdating = False
    Workbooks("Quote Transporter.xlsm").Sheets("Video").Range("B9:H461").Copy _
            Workbooks("NEW Sales Quote Tool USER version 01-191.xlsm").Sheets("Video").Range("B9")
    Application.ScreenUpdating = True
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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