ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,756
- Office Version
- 2007
- Platform
- Windows
Morning.
I have a sheet called MILEAGE (1)
I have c ommamd button with the following code shown below.
When i run the command button code i see a Msgbox saying RTE 9 Subscript out of range.
When i debug i see the line should below in Yellow
I have a sheet called MILEAGE (1)
I have c ommamd button with the following code shown below.
When i run the command button code i see a Msgbox saying RTE 9 Subscript out of range.
When i debug i see the line should below in Yellow
Rich (BB code):
Private Sub CommandButton2_Click()
Dim answer As Long, wb As Workbook
answer = MsgBox("ONLY TRANSFER FIGURES IF ITS THE END OF THE MONTH" & vbNewLine & "" & vbNewLine & "***** DO WE CONTINUE TO TRANSFER THE FIGURES ? *****", vbYesNo + vbCritical, "END OF MONTH TRANSFER QUESTION")
If answer = vbYes Then
Set wb = Workbooks.Open(FileName:="C:\Users\Ian\Desktop\EBAY\ACCOUNTS\CURRENT SHEETS\SUMMARY SHEET 2024-2025.xlsm")
Workbooks("ACCOUNTS.xlsm").Sheets("MILEAGE (1)").Range("C32").Copy
wb.Sheets("SUMMARY SHEET").Range("I17").PasteSpecial xlPasteValues
wb.Close True
Else
Exit Sub
End If
Workbooks("ACCOUNTS.xlsm").Sheets("MILEAGE (1)").Range("A2").Select
Application.CutCopyMode = False
MsgBox "SUMMARY TRANSFER COMPLETE", vbInformation, "SUCCESSFUL MESSAGE"
Sheets("SUMMARY ACCOUNTS").Select
ActiveWorkbook.Save
End Sub