#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 181
Default countblank

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default countblank

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

--
Rick (MVP - Excel)


"Alberto Ast" wrote in message
...
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 181
Default countblank

Thanks Rick... it worked perfect...

"Rick Rothstein" wrote:

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

--
Rick (MVP - Excel)


"Alberto Ast" wrote in message
...
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
countblank with sumproduct? Rene Excel Worksheet Functions 1 May 30th 10 02:21 AM
Countblank Pat Excel Worksheet Functions 1 December 8th 09 08:28 PM
CountBlank with a reset? mpenkala Excel Discussion (Misc queries) 7 February 5th 08 03:07 AM
Countblank formula EElliott Excel Worksheet Functions 4 February 14th 07 01:58 PM
CountBlank in calculation inigo45 Excel Programming 7 February 17th 04 11:11 AM


All times are GMT +1. The time now is 05:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"