Hi Everyone,
I am trying to get a returned count of blank cells for a selection of cells on every row of a spreadsheet and paste the total number of blanks for each row into a cell on another sheet.
The destination cells for the totals are (in bold and the order that they appear in the below code) DT, DF, DG and DH
This code already works to enter the totals in another part of the destination spreadsheet (sheet 2).
But when I have amended the working code which was exactly the same as below except that WorksheetFunction.CountBlank was WorksheetFunction.Sum.
Since changing it to WorksheetFunction.CountBlank I keep getting the error Error Message
"Unable to get the CountBlank property of the Worksheet Function Class"
when I try to run it.
I have been trying to get it working all day. I think it's related to the looping which CountBlank may not get along with?
I am trying to get a returned count of blank cells for a selection of cells on every row of a spreadsheet and paste the total number of blanks for each row into a cell on another sheet.
The destination cells for the totals are (in bold and the order that they appear in the below code) DT, DF, DG and DH
This code already works to enter the totals in another part of the destination spreadsheet (sheet 2).
But when I have amended the working code which was exactly the same as below except that WorksheetFunction.CountBlank was WorksheetFunction.Sum.
Since changing it to WorksheetFunction.CountBlank I keep getting the error Error Message
"Unable to get the CountBlank property of the Worksheet Function Class"
when I try to run it.
I have been trying to get it working all day. I think it's related to the looping which CountBlank may not get along with?
Rich (BB code):
Sub CountMissingT1COREItems()
Dim i As Long
For i = 2 To Cells(Rows.Count, "A").End(xlUp).Row
Worksheets("Sheet2").Range("DT" & i) = WorksheetFunction.CountBlank(Range("AV" & i & ",BF" & i & ",BI" & i & ",BW" & i))
Worksheets("Sheet2").Range("DF" & i) = WorksheetFunction.CountBlank(Range("AT" & i & ",BC" & i & ",BG" & i & ",BL" & i & ",AW" & i & ",BO" & i & ",BS" & i & ",BV" & i & ",AZ" & i & ",BJ" & i & ",BE" & i & ",BT" & i))
Worksheets("Sheet2").Range("DG" & i) = WorksheetFunction.CountBlank(Range("AY" & i & ",BD" & i & ",BM" & i & ",BX" & i & ",AS" & i & ",AU" & i & ",BK" & i & ",BR" & i & ",BB" & i & ",BQ" & i & ",BU" & i & ",BY" & i))
Worksheets("Sheet2").Range("DH" & i) = WorksheetFunction.CountBlank(Range("BA" & i & ",BZ" & i & ",BH" & i & ",BP" & i & ",AX" & i & ",BN" & i))
Next i
End Sub
Last edited by a moderator: