Error 448

J

Jim

I am using the snippet of code below to find a string in columns C & D.
The code works OK in Excel 2003 but when used in Excel 2000 it returns an
error 448 (Named argument not found)
Is this due to a difference between the two versions ?
If so is there a workaround ?
Any and all comments muchly appreciated

Regards & TIA
 
J

Jim

Sub BasicFindReg()
Dim Title As String
Dim RegNo As String

Title = "Test Macro to Find Reg Number"
RegNo = InputBox("Enter the Original Reg No or Present Reg No", Title)

On Error Resume Next
With Columns("C:D")
.Find(What:=RegNo, After:=Range("C1"), LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
_
MatchCase:=False, SearchFormat:=False).Activate
End With

If Error > "0" Then
Response = MsgBox("Error - " & Err, vbOK, Title)
End If

End Sub
 
R

Rowan Drummond

Not sure why you are getting the error (I'm using 2002 and it runs) but
you could try this variation:

Sub BasicFindReg()
Dim Title As String
Dim RegNo As String
Dim theReg As Range

Title = "Test Macro to Find Reg Number"
RegNo = InputBox("Enter the Original Reg No or Present Reg No" _
, Title)

With Columns("C:D")
Set theReg = .Find(What:=RegNo, After:=Range("C1"), _
LookIn:=xlFormulas, LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
End With

If Not theReg Is Nothing Then
theReg.Activate
Else
MsgBox "Reg No: " & RegNo & " not found"
End If

End Sub

Hope this helps
Rowan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top