ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,738
- Office Version
- 2007
- Platform
- Windows
Evening All,
I have the code in use supplied below.
The workbook is callled ACCOUNTS.
The code is on various worksheets all within the ACCOUNTS workbook.
The code is always on COMMAND BUTTON 2
As you see in the code there is the part 2018 - 2019
When the time comes to change this i can see it will take some time to complete hence this post.
Is it possible to have a search & replace code where the code would look for 2018 - 2019 in this open workbook then replace it with 2019 - 2020
The following year i would then just change the dates again to suit.
This would only apply for the current open workbook as i also have past year workbook also called ACCOUNTS
Thanks very much.
I have the code in use supplied below.
The workbook is callled ACCOUNTS.
The code is on various worksheets all within the ACCOUNTS workbook.
The code is always on COMMAND BUTTON 2
As you see in the code there is the part 2018 - 2019
When the time comes to change this i can see it will take some time to complete hence this post.
Is it possible to have a search & replace code where the code would look for 2018 - 2019 in this open workbook then replace it with 2019 - 2020
The following year i would then just change the dates again to suit.
This would only apply for the current open workbook as i also have past year workbook also called ACCOUNTS
Thanks very much.
Code:
Private Sub CommandButton2_Click() Dim Answer As Long, wb As Workbook
Answer = MsgBox("Transfer Values To Summary Sheet ?", vbYesNo + vbInformation, "End Of Month Accounts")
If Answer = vbYes Then
Set wb = Workbooks.Open(Filename:="C:\Users\Ian\Desktop\EBAY\ACCOUNTS\PREVIOUS ACCOUNTS\2018 - 2019\SUMMARY 2018 - 2019.xlsm")
Workbooks("ACCOUNTS").Sheets("MILEAGE").Range("C32").Copy
wb.Sheets("Sheet1").Range("I35").PasteSpecial xlPasteValues
wb.Close True
End If
Workbooks("ACCOUNTS").Sheets("MILEAGE").Range("A3").Select
Application.CutCopyMode = False
MsgBox "Summary Transfer Completed", vbInformation, "SUCCESSFUL MESSAGE"
ActiveWorkbook.Save
End Sub