How do I use VBA in Excel to check if a below cell is empty or not? I want to sum all values in a specific range, but only, if the below cell is not empty.
Is that somehow possible with VBA or any other way?
Example:
4 2 3 2 1
2 3 1
Sum would be: 4 + 3 + 2 = 9.
I've had some problems using just 'IsEmpty' when the data is exported from other databases. This is the function I've developed:
Function IsVacant(TheVar As Variant) As Boolean
'LeandraG 2010
IsVacant = False
If IsEmpty(TheVar) Then IsVacant = True
If Trim(TheVar) = "" Then IsVacant = True
If Trim(TheVar) = "'" Then IsVacant = True
End Function
Try this simple code
If IsEmpty(ActiveCell.Offset(1, 0)) Then
'your code here
End If
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With