I am developing a spreadsheet for analysing expenses & other costs.
The data will be in one of the tabs, the full name of which is not known but we know that the name starts with a known string - in this case "statement".
What I want is the end of the name: F_Nam.
What have I done wrong ? I get error 91 messages
The data will be in one of the tabs, the full name of which is not known but we know that the name starts with a known string - in this case "statement".
What I want is the end of the name: F_Nam.
What have I done wrong ? I get error 91 messages
Code:
Sub WorksheetLoop()
Dim WS_Count As Integer
Dim WS_Name As String
Dim WS_Sht As Worksheet
Dim F_Nam As String
Dim I As Integer
WS_Count = ActiveWorkbook.Worksheets.Count
For I = 1 To WS_Count
ActiveWorkbook.Worksheets(I).Activate
If Mid(WS_Sht.Name, 1, 9) = "statement" Then
F_Nam = Mid(WS_Sht.Name, 10, 6)
MsgBox F_Nam
End If
Next I
End Sub