If a cell is blank in a range
|
Macro Title:
|
|
Worksheet Variable:
|
|
Worksheet Name:
|
|
Test Range Reference:
enter the range that you want to test |
|
Output Cell:
|
|
Value if test is True:
enter the value that you want returned if at least one cell in a range is blank |
|
Value if test is False:
enter the value that you want returned if none of the cells in a range are blank |
|
First Comment:
' |
|
Second Comment:
' |
Sub If_cell_is_blank_in_a_range()
'declare a variable
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'calculate if a cell is blank in a range
If ws.Application.WorksheetFunction.CountBlank(ws.Range("C5:E5")) > 0 Then
ws.Range("F5") = "Need Stock"
Else
ws.Range("F5") = "Stocked"
End If
End Sub
Sub If_cell_is_blank_in_a_range()
'declare a variable
Dim ws As Worksheet
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'calculate if a cell is blank in a range
If ws.Application.WorksheetFunction.CountBlank(ws.Range("C5:E5")) > 0 Then
If ws.Application.WorksheetFunction.CountBlank(ws.Range("C5:E5")) > 0 Then
ws.Range("F5") = "Need Stock"
Else
ws.Range("F5") = "Stocked"
End If
End Sub
