View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default countblank sintax

The range shoudl be contiguous:

Sub dural()
Set r = Range("A1:A3")
MsgBox (Application.WorksheetFunction.CountBlank(r))
Set r = Range("A1,A3")
MsgBox (Application.WorksheetFunction.CountBlank(r))
End Sub


The first countblank works, the second fails.
--
Gary''s Student - gsnu200908


"Alberto Ast" wrote:

I am trying to count blanks on a large range of cells but I am getting an error

My function is as follows

If WorksheetFunction.CountBlank(Range_
("M5:Q5,J8,O8:Q8,O12:Q12,O14:Q14,O17:Q17,O20:Q2 0,_
O23:Q23,J26,A30:Q35,A38:Q44,G17,N26:Q26,J23:K23,C4 6,_
C48,C61,O61:Q61")) 0 Then

when ever us a set as M5:Q5... those are merged cells... I tried with just
first cell of each merge cell lime just M5 but get same error

Run-time error '1004:
Unsable to get the CountBlank property of the worksheetFunction class