Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub PartialWorkbookName()
- Const cStrPartial As String = "Website_20"
- Dim wb As Workbook
- Dim objWb As Workbook
- For Each wb In Workbooks
- If Left(wb.Name, Len(cStrPartial)) = cStrPartial Then
- Set objWb = Workbooks(wb.Name)
- Exit For
- End If
- Next
- If objWb Is Nothing Then GoTo NotFound
- With objWb
- ' Code in here
- End With
- Set objWb = Nothing
- Exit Sub
- NotFound:
- MsgBox "Workbook not found."
- End Sub
Add Comment
Please, Sign In to add comment