Hi,
Pse help! I'm very new to Macros. I have created a Purchase order that is used on site and in our office. We use sharepoint to store/use our data.
I have a command button that should update the purchase order register. However I am having trouble setting the destination workbook..... I set the destination on site as the code below, because there is only one user, but in the office we have a few and so I am having trouble rewriting this so that it accessing the sharepoint file.
This is what I have so far:
Sub UpDateLog()
Dim wb As Workbook, wbTemp As Workbook
Dim ws As Worksheet, wsTemp As Worksheet
Dim lastRow As Long
'source workbook
Set wb = ThisWorkbook
Set ws = wb.Sheets("Purchase Order Template")
'destination workbook
Set wbTemp = Workbooks.Open("C:\Users\Accounts\SharePoint\SHAMROCK CIVIL and CONCRETE P - Doc 2\Suppliers\Purchase Order Register.xlsx")
Set wsTemp = wbTemp.Sheets("Sheet1")
'Paste to next row
lastRow = wsTemp.Range("I" & Rows.Count).End(xlUp).Row + 1
ws.Range("A66:G66").Copy
wsTemp.Range("I" & lastRow).PasteSpecial Paste:=xlValues
Application.CutCopyMode = False
'Cleanup
wbTemp.Close savechanges:=True
Set wb = Nothing: Set wbTemp = Nothing
Set ws = Nothing: Set wsTemp = Nothing
End Sub
Please can someone help!!?? Thank you kindly in advance
Pse help! I'm very new to Macros. I have created a Purchase order that is used on site and in our office. We use sharepoint to store/use our data.
I have a command button that should update the purchase order register. However I am having trouble setting the destination workbook..... I set the destination on site as the code below, because there is only one user, but in the office we have a few and so I am having trouble rewriting this so that it accessing the sharepoint file.
This is what I have so far:
Sub UpDateLog()
Dim wb As Workbook, wbTemp As Workbook
Dim ws As Worksheet, wsTemp As Worksheet
Dim lastRow As Long
'source workbook
Set wb = ThisWorkbook
Set ws = wb.Sheets("Purchase Order Template")
'destination workbook
Set wbTemp = Workbooks.Open("C:\Users\Accounts\SharePoint\SHAMROCK CIVIL and CONCRETE P - Doc 2\Suppliers\Purchase Order Register.xlsx")
Set wsTemp = wbTemp.Sheets("Sheet1")
'Paste to next row
lastRow = wsTemp.Range("I" & Rows.Count).End(xlUp).Row + 1
ws.Range("A66:G66").Copy
wsTemp.Range("I" & lastRow).PasteSpecial Paste:=xlValues
Application.CutCopyMode = False
'Cleanup
wbTemp.Close savechanges:=True
Set wb = Nothing: Set wbTemp = Nothing
Set ws = Nothing: Set wsTemp = Nothing
End Sub
Please can someone help!!?? Thank you kindly in advance