Hi Experts,
I need help on VBA which pop up a message box with 'Yes' or 'No' asking users that "required mandatory are not yet met. Do you still want to save ?".
This VBA shall trigger when users try to save file. I already wrote first level macro but it is not working also I dont know how to write code to ask if they still want to save or not.
Row Range for this VBA -17 to 215 (but may be possible all are not used so probably end row can be identified within this range).
Condition to check for each row - check for each row if Cells(i, "R") is "Approved" and Cells(i,"W") is empty then this is a breach of mandatory condition.
Identify for how many rows this condition is not met and count the total rows.
Trigger this when user tries to save/save as and diplay a message box that Key in column W is missing for these many records. Do you still want to save ?
I tried a macro as given below but its not executing.
Could you please help to fix the macro and add a code to ask user if he still wants to save the file.
I need help on VBA which pop up a message box with 'Yes' or 'No' asking users that "required mandatory are not yet met. Do you still want to save ?".
This VBA shall trigger when users try to save file. I already wrote first level macro but it is not working also I dont know how to write code to ask if they still want to save or not.
Row Range for this VBA -17 to 215 (but may be possible all are not used so probably end row can be identified within this range).
Condition to check for each row - check for each row if Cells(i, "R") is "Approved" and Cells(i,"W") is empty then this is a breach of mandatory condition.
Identify for how many rows this condition is not met and count the total rows.
Trigger this when user tries to save/save as and diplay a message box that Key in column W is missing for these many records. Do you still want to save ?
I tried a macro as given below but its not executing.
VBA Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim i As Long 'variable for row number
Dim j As Long 'variable to store total missing records
i = 17
j = 0
For Each Row In Sheets(">>Pre-C3Commitment_New<<").Range("C17:AG215")
If Cells(i, "R").Value = "2-APPROVED/ACTIVE" & IsEmpty(Cells(i, "W")) Then
j = j + 1
End If
Next Row
If j > 0 Then
Cancel = True
MsgBox "JIRA ID is missing for requests count - " & j, vbInformation
Else
'Do Nothing
End If
End Sub
Could you please help to fix the macro and add a code to ask user if he still wants to save the file.