I'm creating macro Excel that will check if there is empty cells in specific range before closing the Workbook. I have an issue that the range is dynamic , and I have cell that contain the range that I want to check each time, how can I use cell value inside VBA as range.
and this is the VBA
Private Sub Workbook_BeforeClose(Cancel As Boolean) For Each cell In Range("A2:E2") If cell.Value = "" Then MsgBox "Please, fill empty cells", vbInformation, "Warning" cell.Select Cancel = True Exit Sub End If Next End Sub
Private Sub Workbook_Open()
End Sub
thank you