Hello
how can i do If one (or any) cell in the range A1:F1 and the cell H1 are not empty, then all range cells must be not empty.
If not, cancel save and show msg box.
Regards
Claudio.
Hello
how can i do If one (or any) cell in the range A1:F1 and the cell H1 are not empty, then all range cells must be not empty.
If not, cancel save and show msg box.
Regards
Claudio.
try with this..
Sub tst() If Evaluate("OR(ISBLANK(A1:F1),ISBLANK(H1))") Then MsgBox "One of the cell is empty'" Else MsgBox "All are filled" End If End Sub
Regards!
=DEC2HEX(3563)
If you like someone's answer, click the star to give them a reputation point for that answer...
Hello
The problem with this sub is than i that it cancel save when all the cells are empty, and I only want to cancel when one (ore more) of the cells is or are not empty and the other ones are empty.
If all are empty or all not empty do not cancel, in other case, cancel.
Cancel is a part of many eventtrigger macro..
What Trigger you are using..
Hello loroverde,
Do it this way:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) With Sheet1 If Evaluate("OR(ISBLANK(A1:F1),ISBLANK(H1))") Then Cancel = True MsgBox "One or all of the cells are empty. Saving has been Cancelled" Else Cancel = False MsgBox "All Cells are filled, WorkBook will now be Saved", vbOKOnly, ("Contol Check") End If End With End Sub
Please consider:
Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks