其实代码是很简单的,只需要在ThisWorkbook里添加如下代码就OK了:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Len(Worksheets("医学").Range("A1")) = 0 Then ‘判断医学这个SHEET的A1单元格是否为空
MsgBox "A1 Is Null", vbExclamation + vbOKOnly ’空的话,就报提示
Cancel = True
End If
End Sub
用VBA实现Excel中某单元格不能为空
最新推荐文章于 2024-06-09 11:52:10 发布