PDA

View Full Version : error number



lior03
01-03-2006, 08:42 AM
hello
the following macro suppose to select an empty cell in a selection.if i choose a range without a empty cell i get an error (number 1004).what could be doen to prevent the error message?.is it possible to tell excel
that if the error number is so $ so then let an msgbox appear?
thanks

Sub clicko()
Selection.SpecialCells(xlCellTypeBlanks).Select
If Err.number = 1004 Then
MsgBox "no cell found"
End If
End Sub

Bob Phillips
01-03-2006, 09:54 AM
Sub clicko()
Dim rng As Range
On Error Resume Next
Set rng = Selection.SpecialCells(xlCellTypeBlanks)
On Error GoTo 0
If rng Is Nothing Then
MsgBox "no cell found"
Else
rng.Select
End If
End Sub

lior03
01-03-2006, 10:51 PM
hello

this macro work perfectley on excel xp at home.it generate an error message on excel 2000 at work. what am i missing here?.
thanks

johnske
01-04-2006, 01:28 AM
hello

this macro work perfectley on excel xp at home.it generate an error message on excel 2000 at work. what am i missing here?.
thanksNo problems here (Office 2000, Win98 SE)...

ALe
01-04-2006, 02:24 AM
what error?