excel


Posted by Bobby Aujla on May 10, 2001 3:59 AM

Could you please tell me how I can scan through a workbook for a particular row through the use of VBA.

Posted by Dave Hawley on May 10, 2001 4:42 AM


Hi Bobby

Try this macro

Sub FindRow()
'Written by Ozgrid Business Applications
'www.ozgrid.com
Dim wSht As Worksheet
Dim lRow As Long
Dim sName As String

On Error Resume Next
For Each wSht In ActiveWorkbook.Worksheets
With wSht
lRow = .Cells.Find(What:="Dog", After:=.Cells(1, 1) _
, LookAt:=xlWhole).Row
If lRow <> 0 Then
sName = .Name
MsgBox "Found in " & sName & " on row " & lRow
Application.Goto .Rows(lRow), True
Exit Sub
End If
End With
Next wSht
End Sub

OzGrid Business Applications

Posted by Anon on May 10, 2001 4:51 AM

ActiveWindow.ScrollRow = 101 'or whatever row nbr



Posted by Dave Hawley on May 10, 2001 5:02 AM

Bobby, if you already know the row number and sheet you can use:

Sub FindRow()
'Written by Ozgrid Business Applications
'www.ozgrid.com

Application.Goto Sheets("Sheet1").Rows(200), True

End Sub


Dave

OzGrid Business Applications