If a cell is not 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 of the cells in a range has a value |
Value if test is False:
enter the value that you want returned if all of the cells in the range are blank |
First Comment:
' |
Second Comment:
' |
Sub If_cell_is_not_blank_in_range()
'declare a variable
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'calculate if a cell is not blank in a range
If ws.Application.WorksheetFunction.CountA(ws.Range("C5:E5")) > 0 Then
ws.Range("F5") = "Has Value"
Else
ws.Range("F5") = "No Value"
End If
End Sub
Sub If_cell_is_not_blank_in_range()
'declare a variable
Dim ws As Worksheet
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'calculate if a cell is not blank in a range
If ws.Application.WorksheetFunction.CountA(ws.Range("C5:E5")) > 0 Then
If ws.Application.WorksheetFunction.CountA(ws.Range("C5:E5")) > 0 Then
ws.Range("F5") = "Has Value"
Else
ws.Range("F5") = "No Value"
End If
End Sub