Archive of Mr Excel Message Board


Back to Excel VBA archive index
Back to archive home





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.

Check out our Excel VBA Resources

Re: excel

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


Re: excel

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

ActiveWindow.ScrollRow = 101 'or whatever row nbr


Re: excel

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




This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.