View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
KP[_4_] KP[_4_] is offline
external usenet poster
 
Posts: 43
Default Find and delete error value

I am sorry about the insufficient information.
Actually there is more than one.
Do you have another suggestion?

Kaj Pedersen


"Don Guillett" skrev i en meddelelse
...
You didn't say if there was more than ONE. If only one just use FIND

Sub FindString()
On Error Resume Next 'GoTo 0
With Worksheets("sheet9").Range("a1:d50")
Set c = .Find(What:="#I/T", LookIn:=xlValues, _
lookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)
If Not c Is Nothing Then
firstAddress = c.Address
Do
MsgBox c.address 'Row
c.Clear
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With
End Sub




On Oct 2, 12:09 pm, "KP" <none wrote:
Hi,

I need a macro that can find the error value "#I/T" in the range A1:D10
and
clear the contents.
I tried this one below, but it didn't work, so I hope someone can correct
it
or write a complete different macro doing the same thing.
Sub CheckCell()
Dim rCell As Range
Dim sMyString As String

Set rCell = Range("A1:D10")

If IsError(rCell.Value) Then

Cell.ClearContents

End If
End Sub

Regards,
Kaj Pedersen