ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   date/month problem (https://www.excelbanter.com/excel-programming/298012-date-month-problem.html)

No Name

date/month problem
 
i have to link my workbook thru the vba code. The logic is
that i need to look for months. LIke if my worksheet is of
may month then i need to link with a column of anohter
workbook which is also may and likewise continue for
forthcoming months.

i search for may-04 in the workbook. My thought is what if
the user changes May-04 to May'04 or any other format....!
How to resolve this ambiguity...is there a way whereby i
put a condition??? or do i need to write a lot of if
condition's?????????

any thots will be appreciated

Bob Phillips[_6_]

date/month problem
 
You could test left and right,

If Left(ActiveSheet.Name, 3) = Format(Date, "mmm") And _
Right(ActiveSheet.Name, 2) = Format(Date, "yy") Then
' do it

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

wrote in message
...
i have to link my workbook thru the vba code. The logic is
that i need to look for months. LIke if my worksheet is of
may month then i need to link with a column of anohter
workbook which is also may and likewise continue for
forthcoming months.

i search for may-04 in the workbook. My thought is what if
the user changes May-04 to May'04 or any other format....!
How to resolve this ambiguity...is there a way whereby i
put a condition??? or do i need to write a lot of if
condition's?????????

any thots will be appreciated





All times are GMT +1. The time now is 05:25 PM.

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