Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
RAP RAP is offline
external usenet poster
 
Posts: 49
Default sheetname search question

Hello,
Trying to find a way, using VBA, to locate and activate a sheet by name,
using a wildcard search.
The workbooks I need to open are not consistently organized and sheet names
are different, but all contain "Jan" thru "Dec" in some form.
Ex: Platform1 (JAN),Platform2 JAN, Platform3Jan, etc...

Much appreciated. - Randy

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default sheetname search question

One way:

Public Sub ActivateJan()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If UCase(ws.Name) Like "*JAN*" Then
ws.Activate
Exit Sub
End If
Next ws
MsgBox "No JANs found"
End Sub


In article ,
RAP wrote:

Hello,
Trying to find a way, using VBA, to locate and activate a sheet by name,
using a wildcard search.
The workbooks I need to open are not consistently organized and sheet names
are different, but all contain "Jan" thru "Dec" in some form.
Ex: Platform1 (JAN),Platform2 JAN, Platform3Jan, etc...

Much appreciated. - Randy

  #3   Report Post  
Posted to microsoft.public.excel.programming
RAP RAP is offline
external usenet poster
 
Posts: 49
Default sheetname search question

Works just fine. Thank you! Apparently, I just have a thing with syntax. I
was close, but you nailed it. Thanks again,
Randy

"JE McGimpsey" wrote:

One way:

Public Sub ActivateJan()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If UCase(ws.Name) Like "*JAN*" Then
ws.Activate
Exit Sub
End If
Next ws
MsgBox "No JANs found"
End Sub


In article ,
RAP wrote:

Hello,
Trying to find a way, using VBA, to locate and activate a sheet by name,
using a wildcard search.
The workbooks I need to open are not consistently organized and sheet names
are different, but all contain "Jan" thru "Dec" in some form.
Ex: Platform1 (JAN),Platform2 JAN, Platform3Jan, etc...

Much appreciated. - Randy


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatically update SheetName in workbook sub if SheetName changes [email protected] Excel Discussion (Misc queries) 3 February 29th 08 04:33 PM
Does anyone see this .xls]sheetname? Eric Excel Worksheet Functions 2 January 21st 07 03:28 PM
Does anyone see this .xls]sheetname? Eric Excel Discussion (Misc queries) 2 January 21st 07 03:04 PM
search question Leo Excel Programming 1 January 14th 04 01:26 PM
SheetName J.E. McGimpsey Excel Programming 1 September 2nd 03 04:39 PM


All times are GMT +1. The time now is 02:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"