getting a string with a month/year from a date (1 Viewer)

Cowboy_BeBa

Registered User.
Local time
Today, 18:06
Joined
Nov 30, 2010
Messages
188
Hi

I need to use VBA to get a string which is essentially just a month and year (so date, not including day)

Would Prefer it to be 04/15 as opposed to April-15, as the number is easier to sort than the word (though if anyone knows how to sort month names in numerical order as opposed to alphabetical id love to hear a way)

so that i assume i could do by =format(now(), mm/yy) (though havent actually tested it)
however to add to the complexity id also need to add a month to it, so for instance todays date is 08/04/15, id need the string to read "05/15"
or if the date was 10/12/15 id need the string to read "01/16"

does anyone know how id be able to do this?
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 03:06
Joined
Aug 30, 2003
Messages
36,149
You can use the DateAdd() function to add a month to the current date, and use the Format() function on that.
 

Cowboy_BeBa

Registered User.
Local time
Today, 18:06
Joined
Nov 30, 2010
Messages
188
Perfect
thanks once again Pbaldy :)
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 03:06
Joined
Aug 30, 2003
Messages
36,149
No problemo!
 

Users who are viewing this thread

Top Bottom