Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
clippan
 
Posts: n/a
Default Using worksheet functions in macros in Excel2000

Hello. I'm trying and trying to use a worksheet function in a macro. What Im
trying
to do is to calculate the number of empty cells in a range of cells in the
worksheet
and then use the answer to jump in the macro. To get the number in a worksheet
I guess I can use CountBlanks or CountIf. For example. =CountIf(B2:J10;"")

Now I'm trying to use this function in a macro and I'm trying to write
something like:

IF (Number of empty cells in range( ) ) = X THEN GOTO .....

I can't figure this out. I've tried writings like:

Dim ... As ......
..
..
IF Application.WorksheetFunction.CountBlank( Worksheets(1).Range("A1:A10"))
= X THEN GOTO ....
..
Nothing works. Lots and lots of different errors.

Frankly, I'm realazing that I'm no good at this. Could someone please write
down what I have to write in my macro and what kind of definitions I also
have to do like Dim ... As.... (if any)


--
Many thanks in advance !
Clippan
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips
 
Posts: n/a
Default Using worksheet functions in macros in Excel2000

Try

If Application.countif(worksheets(1).range("B2:J10"), "")

or

If Application.countblank(worksheets(1).range("B2:J10 "))

both worked for me

--

HTH

RP
(remove nothere from the email address if mailing direct)


"clippan" wrote in message
...
Hello. I'm trying and trying to use a worksheet function in a macro. What

Im
trying
to do is to calculate the number of empty cells in a range of cells in the
worksheet
and then use the answer to jump in the macro. To get the number in a

worksheet
I guess I can use CountBlanks or CountIf. For example. =CountIf(B2:J10;"")

Now I'm trying to use this function in a macro and I'm trying to write
something like:

IF (Number of empty cells in range( ) ) = X THEN GOTO .....

I can't figure this out. I've tried writings like:

Dim ... As ......
.
.
IF Application.WorksheetFunction.CountBlank(

Worksheets(1).Range("A1:A10"))
= X THEN GOTO ....
.
Nothing works. Lots and lots of different errors.

Frankly, I'm realazing that I'm no good at this. Could someone please

write
down what I have to write in my macro and what kind of definitions I also
have to do like Dim ... As.... (if any)


--
Many thanks in advance !
Clippan



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
advanced: synchronizing data value across two worksheet drop boxes mdhokie Excel Worksheet Functions 1 October 6th 05 08:46 PM
Macro to search for and display data in another worksheet Mark H Excel Worksheet Functions 0 June 14th 05 12:40 PM
Copy from worksheet to another x times Union70 Excel Discussion (Misc queries) 0 March 7th 05 09:03 PM
Indirect reference from one worksheet to another Bill Sturdevant Excel Worksheet Functions 2 December 17th 04 01:23 PM
worksheet functions with dates Michele Excel Worksheet Functions 3 December 6th 04 06:05 PM


All times are GMT +1. The time now is 07:09 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"