ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SpecialCells Doesn't Work in a Function?? (https://www.excelbanter.com/excel-programming/284297-specialcells-doesnt-work-function.html)

Alex J

SpecialCells Doesn't Work in a Function??
 
All,

I have written a Function to calculate a SUMIF function on a filtered range,
and want to use Range.SpecialCells(xlCellTypeVisible). It won't work.

When I take the identical statements and set up a subroutine, it works?

Any thoughts??

Test=Application.WorksheetFunction.SumIF(ChkRng.Sp ecialCells(xlcelltypeVisib
le), "YES", SumRng.SpecialCells(xlcelltypeVisible))

test =Application.WorksheetFunction.SumIf( _
ChkRng.SpecialCells(xlCellTypeVisible), _
"YES", _
SumRng.SpecialCells(xlCellTypeVisible))




Tom Ogilvy

SpecialCells Doesn't Work in a Function??
 
Just confirm that what you say is true. There are several
methods/properties that don't seem to work in a UDF used in a worksheet.



--
Regards,
Tom Ogilvy

"Alex J" wrote in message
. ..
All,

I have written a Function to calculate a SUMIF function on a filtered

range,
and want to use Range.SpecialCells(xlCellTypeVisible). It won't work.

When I take the identical statements and set up a subroutine, it works?

Any thoughts??


Test=Application.WorksheetFunction.SumIF(ChkRng.Sp ecialCells(xlcelltypeVisib
le), "YES", SumRng.SpecialCells(xlcelltypeVisible))

test =Application.WorksheetFunction.SumIf( _
ChkRng.SpecialCells(xlCellTypeVisible), _
"YES", _
SumRng.SpecialCells(xlCellTypeVisible))






Alex J

SpecialCells Doesn't Work in a Function??
 
Thanks for your reply, Tom. I thought I was seeing things for a while!

Alex J

"Tom Ogilvy" wrote in message
...
Just confirm that what you say is true. There are several
methods/properties that don't seem to work in a UDF used in a worksheet.



--
Regards,
Tom Ogilvy

"Alex J" wrote in message
. ..
All,

I have written a Function to calculate a SUMIF function on a filtered

range,
and want to use Range.SpecialCells(xlCellTypeVisible). It won't work.

When I take the identical statements and set up a subroutine, it works?

Any thoughts??



Test=Application.WorksheetFunction.SumIF(ChkRng.Sp ecialCells(xlcelltypeVisib
le), "YES", SumRng.SpecialCells(xlcelltypeVisible))

test =Application.WorksheetFunction.SumIf( _
ChkRng.SpecialCells(xlCellTypeVisible), _
"YES", _
SumRng.SpecialCells(xlCellTypeVisible))









All times are GMT +1. The time now is 11:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com