Window Selection based on name pattern
Give subroutine a try...
Sub ActivateWS(SheetNameEnding As String)
Dim C As Worksheet
For Each C In Worksheets
If C.Name Like "*" & PartialSheetName Then
C.Activate
Exit For
End If
Next
End Sub
And call it from your own code (macro, function, event procedure, etc.) like
this...
ActivateWS "_practice.xls"
--
Rick (MVP - Excel)
"Abhijat" wrote in message
...
Hi Group,
I was wondering if there is a way in VBA to make that excel
spreadsheet as active window which has name ending with a fixed
string? For example: if a lot of excel spreadsheets are open at the
same time, all in the same session of course, my code should identify
the spreadsheet whose name is ending with something like
xxxxx_practice.xls and make it as active window.
Many thanks!
Best Regards,
Abhijat
|