Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
advanced: synchronizing data value across two worksheet drop boxes | Excel Worksheet Functions | |||
Macro to search for and display data in another worksheet | Excel Worksheet Functions | |||
Copy from worksheet to another x times | Excel Discussion (Misc queries) | |||
Indirect reference from one worksheet to another | Excel Worksheet Functions | |||
worksheet functions with dates | Excel Worksheet Functions |