View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default search 2 Columns Please

Delete the "" sign
or just try:
Application.Goto Reference:=RgFound.Offset(0, -1)

Steved wrote:

Hello Tom From Steved

Thankyou for your quick response.

Application.Goto Reference:= _
RgFound.Offset(0, -1).Address(True, True, xlR1C1)

The above is giving me the below error, What doI needto do please. Thanks

---------------------------
Microsoft Visual Basic
---------------------------
Compile error:

Syntax error
---------------------------
OK Help
---------------------------

"Tom Ogilvy" wrote:

Sub FindPart()
Dim res, saddr as String
Dim RgToSearch As Range, RgFound As Range

Set RgToSearch = ActiveSheet.Range("C:C")

res = Application.InputBox("Type School Number", _
"Find School", , , , , , 2)
If res = "False" Then Exit Sub 'exit if Cancel is clicked
res = Trim(UCase(res))
If res = "" Then Exit Sub 'exit if no entry and OK is clicked

Set RgFound = RgToSearch.Find(what:=res, _
LookIn:=xlValues, lookat:=xlWhole, MatchCase:=False)
If RgFound Is Nothing Then
MsgBox "School " & res & " not found."
exit Sub
Else
sAddr = RgFound.Address
do
if rgFound.Offset(0,1).Text = "3.30" then
Application.Goto Reference:= _
RgFound.Offset(0, -1).Address(True, True, xlR1C1)
exit do
set rgFound = RgToSearch.FindNext(rgFound)
Loop while rgFound < sAddr

End If
if rgFound.Offst(0,1).Text < "3.30" then
msgbox " School found, but not 3.30"
End if
End Sub

--
Regards,
Tom Ogilvy




--

Dave Peterson