countblank

  • Thread starter Thread starter Alberto Ast
  • Start date Start date
A

Alberto Ast

How do I use countblank in a macro, I got as follows but it gives me an error

Sub Clear()
If CountBlank(ActiveCell.Resize(1, 19)) > 0 Then
Range("A1").Select
Else
Range("B1").Select
End If
End Sub
 
CountBlank is not a VB function, it is a worksheet function, so you have to
specify that...

If WorksheetFunction.CountBlank(ActiveCell.Resize(1, 19)) >0 Then
 
Thanks Rick... it worked perfect...

Rick Rothstein said:
CountBlank is not a VB function, it is a worksheet function, so you have to
specify that...

If WorksheetFunction.CountBlank(ActiveCell.Resize(1, 19)) >0 Then
 
Back
Top