VBA code for copying/ pasting data from one worksheet to another

smithan04

New Member
Joined
Jul 18, 2011
Messages
18
I am new to vba. What I am trying to do is copy data from my root workbook and paste the data in any workbook I have open. For example, from my root wk I would copy range (al138:bz138) and paste these formulas in the same location in current active workbook.

Any advice is appreciated. Thank you.
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Root workbook name: Root
Sheet where data is located: Rootsheet

Change the above info in the macro to what your real workbook and sheet is named.

Code:
Sub pasteroottotarget()
Set wss = ActiveWorkbook.ActiveSheet
Workbooks.("Root.xls").Worksheets("Rootsheet").Range("AL138:BZ138").Copy
Wss.Range("AL138:BZ138").PasteSpecial xlPasteFormulas 

end Sub
See if this works for you. When you run this macro it will paste your root data to what ever workbook & sheet is currently activated (on top).

Assign this macro a hotkey to make it easily used ( Alt+F8, choose macro, click Options).
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,550
Messages
6,179,463
Members
452,915
Latest member
hannnahheileen

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