View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Alex J Alex J is offline
external usenet poster
 
Posts: 85
Default 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))