If a cell is blank
Macro Title:
|
Worksheet Variable:
|
Worksheet Name:
|
Test Cell Reference:
enter the cell that you want to test |
Output Cell:
|
Value if test is True:
enter the value that you want returned if a cell is blank |
Value if test is False:
enter the value that you want returned if a cell is not blank |
First Comment:
' |
Second Comment:
' |
Sub If_a_cell_is_blank_using_IsEmpty()
'declare a variable
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'calculate if a cell is blank
If IsEmpty(ws.Range("C5")) Then
ws.Range("D5") = "No"
Else
ws.Range("D5") = "Yes"
End If
End Sub
Sub If_a_cell_is_blank_using_IsEmpty()
'declare a variable
Dim ws As Worksheet
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'calculate if a cell is blank
If IsEmpty(ws.Range("C5")) Then
If IsEmpty(ws.Range("C5")) Then
ws.Range("D5") = "No"
Else
ws.Range("D5") = "Yes"
End If
End Sub