Copy Range of Data to another Workbook

ststern45

Well-known Member
Joined
Sep 17, 2005
Messages
898
Office Version
  1. 2010
Platform
  1. Windows
Hi everyone,

I have 10 Excel workbooks in a folder C:\States\------.xls

I have 1 Excel workbook named Charts.xls in the same folder.
The worksheet tab is named Workouts

I would like to know if it is possible to:

1. Create a macro that will open a Dialog Box where I can enter the name any 1 of the 10 named workbooks in c:\States folder.

2. Copy and paste a range of cells B6:D100 into the Excel workbook Charts.xls (tab Workouts) cell range B6:D100.



Thanks,

Steve
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Lavan

Board Regular
Joined
Dec 15, 2004
Messages
56
Steve, Try below code.. Its pastes the data on new workbook from Cell A1

Sub paste_to_workbook()

Dim spath As String
spath = "c:\states\"
Sheets("workouts").Activate
Range("B6:D100").Select
Selection.Copy
workbook_name = InputBox("Enter the workbook name to paste data")
Workbooks.Open Filename:=(spath & workbook_name)
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False

End Sub

Hope it helps

Lavan
 
Upvote 0

Forum statistics

Threads
1,190,631
Messages
5,982,031
Members
439,750
Latest member
megaman777

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