Before the line 'serviceprovidersWorkbook.Activate' I would like to add a Yes, No,…
- User
Before the line 'serviceprovidersWorkbook.Activate' I would like to add a Yes, No, message box to the code with the message "Have you selected a cell in the Event Row you would like to send to the Request Events? 'LINE SPACE' If not please select a cell in the row to send. If No, then exit Else continue with code
Dim reventsSheet As Worksheet 'Set reventsSheet = Workbooks("Service Providers.xlsm").Sheets("Events") Set reventsSheet = serviceprovidersWorkbook.Sheets("Request Events")
serviceprovidersWorkbook.Activate reventsSheet.Select
Dim lastRow As Long lastRow = reventsSheet.Cells(Rows.Count, "B").End(xlUp).Row + 1
reventsSheet.Range("B" & lastRow).Value = prmrequestsSheet.Range("F" & selectedRow.Row).Value reventsSheet.Range("C" & lastRow).Value = prmrequestsSheet.Range("D" & selectedRow.Row).Value reventsSheet.Range("D" & lastRow).Value = prmrequestsSheet.Range("E" & selectedRow.Row).Value reventsSheet.Range("F" & lastRow).Value = prmrequestsSheet.Range("M" & selectedRow.Row).Value
prmrequestsWorkbook.Activate prmrequestsWorkbook.Sheets("PrmRequests").Select
MsgBox "Request successfully copied to Request Events."
- Assistant
You can add the message box with the following code:
Dim response As Integer response = MsgBox("Have you selected a cell in the Event Row you would like to send to the Request Events?" & vbCrLf & "If not, please select a cell in the row to send.", vbQuestion + vbYesNo, "Cell Selection")
If response = vbNo Then Exit Sub End If
Before the line "serviceprovidersWorkbook.Activate", the complete code will be:
Dim response As Integer response = MsgBox("Have you selected a cell in the Event Row you would like to send to the Request Events?" & vbCrLf & "If not, please select a cell in the row to send.", vbQuestion + vbYesNo, "Cell Selection")
If response = vbNo Then Exit Sub End If
Dim reventsSheet As Worksheet 'Set reventsSheet = Workbooks("Service Providers.xlsm").Sheets("Events") Set reventsSheet = serviceprovidersWorkbook.Sheets("Request Events")
serviceprovidersWorkbook.Activate reventsSheet.Select
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.