Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Error Handling for xlCellTypeFormulas | Excel Worksheet Functions | |||
Specialcells | Charts and Charting in Excel | |||
VBA ON ERROR does not work with SPECIALCELLS | Excel Discussion (Misc queries) | |||
AutoFilter /specialcells | Excel Programming | |||
specialcells(xlcelltypeblanks) | Excel Programming |