Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Error Control - null rnage

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 143
Default Error Control - null rnage

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Error Control - null rnage


"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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Error Control - null rnage

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
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
Subscript out of Range Error if Null [email protected] Excel Programming 0 November 9th 07 05:50 PM
counting dates within a rnage [email protected] Excel Programming 2 March 6th 06 05:44 PM
Rnage Finder JosephC Excel Worksheet Functions 1 February 21st 06 12:33 AM
summing data that match critieria in a rnage sandyix Excel Discussion (Misc queries) 4 February 21st 05 01:39 AM
Invalid use of Null error Stuart[_5_] Excel Programming 2 October 19th 04 04:18 PM


All times are GMT +1. The time now is 09:35 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"