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.
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.