ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   help with debug (https://www.excelbanter.com/excel-programming/306502-help-debug.html)

Jim May

help with debug
 
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,



Tom Ogilvy

help with debug
 
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

--
Regards,
Tom Ogilvy



"Jim May" wrote in message
news:CI2Sc.17532$Bb.17221@lakeread08...
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,





Jim May

help with debug
 
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


"Tom Ogilvy" wrote in message
...
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

--
Regards,
Tom Ogilvy



"Jim May" wrote in message
news:CI2Sc.17532$Bb.17221@lakeread08...
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,








All times are GMT +1. The time now is 05:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com