LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 148
Default Change Day to Month - VBA

Hi,

I got this macro from this NG to promt a password for a particular "day".
How do you change the macro to a particular "month and year".

from (#9/10/2007#) to Sep 2007
from (#9/11/2007#) to Oct 2007
from (#9/12/2007#) to Nov 2007

The format from vba help, "month(#9/10/2007#)" did not work.

Sub PWforDate()
Dim arrPwords(1 To 3, 1 To 2) As Variant
Dim strPWord As String

arrPwords(1, 1) = (#9/10/2007#)
arrPwords(2, 1) = (#9/11/2007#)
arrPwords(3, 1) = (#9/12/2007#)
arrPwords(1, 2) = 1234
arrPwords(2, 2) = 2345
arrPwords(3, 2) = 3456
strPWord = CStr(Application.VLookup(Date, arrPwords, 2, 0))
MsgBox strPWord
End Sub

Thank you.
 
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
6 month annualized % change [email protected] Excel Discussion (Misc queries) 1 February 28th 07 04:03 PM
How do I put a Month into a cell and have the cells below change Cathy in Florida Excel Discussion (Misc queries) 1 July 14th 06 07:48 PM
How do you change the year but not the month automatically? Autumn Dreams Excel Discussion (Misc queries) 3 May 28th 06 05:41 PM
how do i change the format for excel to day-month swy Excel Worksheet Functions 1 July 2nd 05 07:09 AM
month to month % change Susan Excel Worksheet Functions 2 May 20th 05 08:18 PM


All times are GMT +1. The time now is 08:52 PM.

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

About Us

"It's about Microsoft Excel"