farmerscott
Well-known Member
- Joined
- Jan 26, 2013
- Messages
- 824
- Office Version
- 365
- Platform
- Windows
Hi Everybody,
1. Just wondering if anyone had a good way to check if there was any blanks in an array? It has to cover numbers and words. I would like to check it first and then 'do something', if possible.
2. Does anyone know why the following COUNTBLANK is erroring when the AVERAGE is working fine?
thanks,
FarmerScott
1. Just wondering if anyone had a good way to check if there was any blanks in an array? It has to cover numbers and words. I would like to check it first and then 'do something', if possible.
2. Does anyone know why the following COUNTBLANK is erroring when the AVERAGE is working fine?
Code:
Sub Add_average_data()
Dim x As Long
Dim y As Long
Dim cell As Range
Dim arr As Variant
lr = Worksheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row
arr = Sheets(1).Range("B2:B" & lr)
y = Application.WorksheetFunction.CountBlank(arr)
x = WorksheetFunction.Average(arr)
End Sub
thanks,
FarmerScott