ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   partial search (https://www.excelbanter.com/excel-programming/373235-partial-search.html)

Arne Hegefors

partial search
 
I have a macro. I want to search my worksheets to see if there is any
worksheet that has the current date as worksheet name. however the current
date may only be part of the worksheet name eg "2006-09-19" or "2006-09-19
Vector". I do not know how to find the ones that have a name like "2006-09-19
Vector". My code now is:
For j = 1 To i + 1
If Sheets(j).Name = Format(Date, "YYYY-MM-DD") Then 'wrong
blnIsToday = True
End If
pls help me!! thanks very much!!!

Tom Ogilvy

partial search
 
For j = 1 To i + 1
If instr(1,Sheets(j).Name,Format( _
Date, "YYYY-MM-DD"),vbTextcompare) Then
set sh = Sheets(j)
blnIsToday = True
End If
Next j

--
Regards,
Tom Ogilvy


"Arne Hegefors" wrote:

I have a macro. I want to search my worksheets to see if there is any
worksheet that has the current date as worksheet name. however the current
date may only be part of the worksheet name eg "2006-09-19" or "2006-09-19
Vector". I do not know how to find the ones that have a name like "2006-09-19
Vector". My code now is:
For j = 1 To i + 1
If Sheets(j).Name = Format(Date, "YYYY-MM-DD") Then 'wrong
blnIsToday = True
End If
pls help me!! thanks very much!!!



All times are GMT +1. The time now is 03:39 AM.

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