Code to find to count blank cells in excel

Code to find  to count blank cells in excel

 dim c as long  
 on error resume next  
 c = range("d42:d51").specialcells(xlcelltypeblanks).count  
 on error goto 0  
 if c>0 then  
 msgbox "your message here",vbcritical  
 end if