Is it possible to do a validation when the save button is clicked?
Example, if cell A2 is blank, then when the save button is clicked, a message box with a message "This is a required field".
Is it possible to do a validation when the save button is clicked?
Example, if cell A2 is blank, then when the save button is clicked, a message box with a message "This is a required field".
Hi
How about a before save event
HTH![]()
Please Login or Register to view this content.
rylo
For this code, how am I suppose to modify it such a way that if B2 or any other column in B has value, A2 or any other column in A is required also?Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If IsEmpty(Sheets("Sheet1").Range("A2")) Then
Sheets("Sheet1").Activate
Range("A2").Select
MsgBox "Fill in the required cell A2."
Cancel = True
End If
End Sub
Hi
How about
It will check all the cells in sheet1 column B for the used range, and if there is something in column B and nothing in the equivalent column A cell, it will put up the message and stop the save process.![]()
Please Login or Register to view this content.
rylo
That is strange i still manage to save it even when one column of A is blank and B has value
Hi
Can you put up an example file so we can see what you have.
rylo
Here is the excel file:
OCC.xlsm
it will be helpful if u can solve this problem
Sorry I solved my problem upon looking at this forum
http://www.excelforum.com/showthread...ook_BeforeSave
I put my code at the wrong place haha.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks