In the following vba code, I need to add an action after oP.Range("F1").Value = "". The…
- User
In the following vba code, I need to add an action after oP.Range("F1").Value = "".
The action is this: In workbook 'Service Providers' sheet 'Start Page' range P44, change the value to "SC Incomplete"
MsgBox "Incomplete Scoring was found for the following tasks:" & vbCrLf & incompleteTasks & vbCrLf & _ "Please complete scoring as required, then close this workbook and print the Task Sheet(s).", vbCritical, "PRINT TASK SHEETS" oP.Unprotect Password:="edit" oP.Range("D1").Value = "Incomplete" oP.Range("F1").Value = ""
- Assistant
To add the specified action of changing the value of range P44 in the 'Start Page' sheet of the 'Service Providers' workbook to "SC Incomplete" after the line that sets
oP.Range("F1").Valueto an empty string, you would use the following code snippet.Make sure to properly reference the workbook and sheet in your code to avoid any runtime errors. Here’s how you can modify your existing code:
' Your existing code MsgBox "Incomplete Scoring was found for the following tasks:" & vbCrLf & incompleteTasks & vbCrLf & _ "Please complete scoring as required, then close this workbook and print the Task Sheet(s).", vbCritical, "PRINT TASK SHEETS" oP.Unprotect Password:="edit" oP.Range("D1").Value = "Incomplete" oP.Range("F1").Value = "" ' New action to change the value in 'Service Providers' workbook, 'Start Page' sheet, range P44 Dim wbServiceProviders As Workbook Dim wsStartPage As Worksheet Set wbServiceProviders = Workbooks("Service Providers") ' Ensure the workbook is open Set wsStartPage = wbServiceProviders.Sheets("Start Page") wsStartPage.Range("P44").Value = "SC Incomplete" ' Change the value to "SC Incomplete"