Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default SpecialCells(xlCellTypeFormulas)

Hi guys. I'm looking for a way to keep the following line:

Set oRange = oSheet.Cells.SpecialCells(xlCellTypeFormulas)


from returning an error.

I do know that a similar line of code:

Set oRange = oSheet.Cells.SpecialCells(xlCellTypeBlanks)

can be kept from raising an error if I use the following undocumented excel featu

x = oSheet.Application.CountBlank(oRange)


...is there a similar one for xlCellTypeFormulas?

-K
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default SpecialCells(xlCellTypeFormulas)

If no cells meet the criteria, then specialcells returns an error.

The general approach is to trap the error.

Dim oRange as Range
On Error Resume Next
Set oRange = oSheet.Cells.SpecialCells(xlCellTypeFormulas)
On Error goto 0
if not oRange is Nothing then
' cells were found meeting the criteria
else
' cells were not found meeting the criteria
End if

--
Regards,
Tom Ogilvy

"Kevin Gabbert" wrote in message
om...
Hi guys. I'm looking for a way to keep the following line:

Set oRange = oSheet.Cells.SpecialCells(xlCellTypeFormulas)


from returning an error.

I do know that a similar line of code:

Set oRange = oSheet.Cells.SpecialCells(xlCellTypeBlanks)

can be kept from raising an error if I use the following undocumented

excel featu

x = oSheet.Application.CountBlank(oRange)


..is there a similar one for xlCellTypeFormulas?

-K



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
Error Handling for xlCellTypeFormulas ccfcrup Excel Worksheet Functions 1 January 23rd 08 09:20 PM
Specialcells Bruno Uato Charts and Charting in Excel 0 October 7th 05 07:42 PM
VBA ON ERROR does not work with SPECIALCELLS Felix Excel Discussion (Misc queries) 2 April 14th 05 10:43 PM
AutoFilter /specialcells Ron de Bruin Excel Programming 8 January 13th 04 03:45 PM
specialcells(xlcelltypeblanks) Neil[_11_] Excel Programming 5 October 9th 03 10:11 AM


All times are GMT +1. The time now is 10:15 PM.

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"