help with debug

  • Thread starter Thread starter Jim May
  • Start date Start date
J

Jim May

Why is this not working?

Sub FindSheet()
Dim Temp As String
Dim i As Integer
Temp = InputBox("Enter Sheet Name")
For Each Sheet In ActiveWorkbook <<< Bombing here at this line !!
If ActiveSheet.Name = Temp Then
MsgBox "Found the sheet!", vbOKOnly
End If
Next
End Sub

Thanks in Advance,
 
Sub FindSheet()
Dim Temp As String
Dim i As Integer
Temp = InputBox("Enter Sheet Name")
For Each Sht In ActiveWorkbook.Worksheets
If lcase(Sht.Name) = lcase(Temp) Then
MsgBox "Found the sheet!", vbOKOnly
Exit For
End If
Next
End Sub
 
Thanks Tom; have printed off for "in-depth" study.
It's depressing to have worked with this stuff as long as I have
and to know as little as I do,
we all appreciate your giving-attitude.
Jim
 

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

Back
Top