R
RShow
I had to add the IF statement below to stop the Loop if MyValue wasn't found
on any of the
sheets. Is there any better way to do the following, or since this seems to
work, just leave it alone? workbook has only 8 sheets.
Thanks.
the code:
MyValue = PO_Number
Dim MyVar
On Error Resume Next
a = 1
Do While MyVar = ""
MyVar = Application.WorksheetFunction _
.Match(MyValue, Worksheets(a).Range("E1:E3000"), 0)
a = a + 1
If a = 8 And MyVar = "" Then
MsgBox ("PO # Not Found In Records.")
Exit Sub
End If
Loop
' Select sheet and cell after finding
Sheets(Worksheets(a - 1).Name).Select
Range("E" & MyVar).Select
on any of the
sheets. Is there any better way to do the following, or since this seems to
work, just leave it alone? workbook has only 8 sheets.
Thanks.
the code:
MyValue = PO_Number
Dim MyVar
On Error Resume Next
a = 1
Do While MyVar = ""
MyVar = Application.WorksheetFunction _
.Match(MyValue, Worksheets(a).Range("E1:E3000"), 0)
a = a + 1
If a = 8 And MyVar = "" Then
MsgBox ("PO # Not Found In Records.")
Exit Sub
End If
Loop
' Select sheet and cell after finding
Sheets(Worksheets(a - 1).Name).Select
Range("E" & MyVar).Select