Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
What test can be used to stop the following code Range(.Cells(iFirstDataRow, iTestCol), .Cells(lFinalRow, iTestCol)).SpecialCells(xlCellTypeFormulas, 7) erroring when there are no cells identified by the Goto-Special command? i.e. I sometimes get error 1004 - "no cells were found" thanks Tim |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Jan 7, 5:03*pm, "Tim Childs" wrote:
Hi What test can be used to stop the following code Range(.Cells(iFirstDataRow, iTestCol), .Cells(lFinalRow, iTestCol)).SpecialCells(xlCellTypeFormulas, 7) erroring when there are no cells identified by the Goto-Special command? i.e. I sometimes get error 1004 - "no cells were found" thanks Tim Hi Tim: You need to trap the error: Sub marine() Dim r As Range On Error Resume Next Set r = Cells.SpecialCells(xlCellTypeFormulas) If r Is Nothing Then MsgBox "r is nothing" End If End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "James Ravenswood" wrote in message ... On Jan 7, 5:03 pm, "Tim Childs" wrote: Hi What test can be used to stop the following code Range(.Cells(iFirstDataRow, iTestCol), .Cells(lFinalRow, iTestCol)).SpecialCells(xlCellTypeFormulas, 7) erroring when there are no cells identified by the Goto-Special command? i.e. I sometimes get error 1004 - "no cells were found" thanks Tim Hi Tim: You need to trap the error: Sub marine() Dim r As Range On Error Resume Next Set r = Cells.SpecialCells(xlCellTypeFormulas) If r Is Nothing Then MsgBox "r is nothing" End If End Sub |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi James
Many thanks for that solution bw Tim "James Ravenswood" wrote in message ... On Jan 7, 5:03 pm, "Tim Childs" wrote: Hi What test can be used to stop the following code Range(.Cells(iFirstDataRow, iTestCol), .Cells(lFinalRow, iTestCol)).SpecialCells(xlCellTypeFormulas, 7) erroring when there are no cells identified by the Goto-Special command? i.e. I sometimes get error 1004 - "no cells were found" thanks Tim Hi Tim: You need to trap the error: Sub marine() Dim r As Range On Error Resume Next Set r = Cells.SpecialCells(xlCellTypeFormulas) If r Is Nothing Then MsgBox "r is nothing" End If End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Subscript out of Range Error if Null | Excel Programming | |||
counting dates within a rnage | Excel Programming | |||
Rnage Finder | Excel Worksheet Functions | |||
summing data that match critieria in a rnage | Excel Discussion (Misc queries) | |||
Invalid use of Null error | Excel Programming |