If a cell is not 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 not blank |
Value if test is False:
enter the value that you want returned if a cell is blank |
First Comment:
' |
Second Comment:
' |
Sub If_a_cell_is_not_blank_using_Not_and_IsEmpty()
'declare a variable
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'calculate if a cell is not blank
If Not (IsEmpty(ws.Range("C5"))) Then
ws.Range("D5") = "Yes"
Else
ws.Range("D5") = "No"
End If
End Sub
Sub If_a_cell_is_not_blank_using_Not_and_IsEmpty()
'declare a variable
Dim ws As Worksheet
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'calculate if a cell is not blank
If Not (IsEmpty(ws.Range("C5"))) Then
If Not (IsEmpty(ws.Range("C5"))) Then
ws.Range("D5") = "Yes"
Else
ws.Range("D5") = "No"
End If
End Sub