Copying data from one workbook to another using macro(not links)

travieman9

New Member
Joined
Apr 12, 2019
Messages
1
So I was trying eliminate the need to link two cells from separate workbooks because both workbooks are password protected and its an issue to have to enter both of the passsword everytime i open the single workbook. So i was trying to make a button or even perhaps a constantly running macro that will send these values to the other workbook without the need to link them (and preferably have them both open). This is what I have.

Option Explicit


Sub exportData()
Dim ws As Worksheet
Dim wb As Workbook
Dim ws2 As Worksheet




' set workbook and worksheets
Set ws = ActiveWorkbook.Sheets("Hours")
Set wb = Workbooks("Facility_Maintenance_Work_Orders.xls")
Set ws2 = wb.Sheets("Facility")






' copy cells from active workbook to another (possibly closed) workbook
ws2.Range(“A47") = ws.Range("M21")
ws2.Range(“A51”) = ws.Range(“M22”)
ws2.Range(“A55”) = ws.Range(“M23”)


End Sub

currently it is saying it has a syntax error on the 1'st line where i am trying to copy data to A47. Any help would be appreciated.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Forum statistics

Threads
1,223,895
Messages
6,175,257
Members
452,625
Latest member
saadat28

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