Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Grd Grd is offline
external usenet poster
 
Posts: 118
Default Need to create function to find first day of following month

Hi,

I'm struggling to get the function working to figure out the first day of
the following month. So if I have a cell with say 23 July I want my function
to result in 1st Aug.

I need this to be function not a formula cos I'm going to refer to it in my
code.

any help greatly appreciated


Thanks

Suzanne


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 772
Default Need to create function to find first day of following month

see if this is what you want, may have to change sheet and cell ref

startmonth = Month(Sheets(1).Cells(1, 2))
endmonth = startmonth + 1
MsgBox "1st " & MonthName(endmonth)

--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Grd" wrote:

Hi,

I'm struggling to get the function working to figure out the first day of
the following month. So if I have a cell with say 23 July I want my function
to result in 1st Aug.

I need this to be function not a formula cos I'm going to refer to it in my
code.

any help greatly appreciated


Thanks

Suzanne


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Need to create function to find first day of following month

demo't from the immediate window:

dt = DateValue("July 23, 2007")
dtNext = DateSerial(year(dt),Month(dt)+1,0)
? format(dtNext,"dddd")
Tuesday
? dtNext
07/31/2007

--
regards,
Tom Ogilvy


"Grd" wrote:

Hi,

I'm struggling to get the function working to figure out the first day of
the following month. So if I have a cell with say 23 July I want my function
to result in 1st Aug.

I need this to be function not a formula cos I'm going to refer to it in my
code.

any help greatly appreciated


Thanks

Suzanne


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Need to create function to find first day of following month

Sorry, had a typo in my dtNext formula and wasn't paying attention:

dt = DateValue("July 23, 2007")
dtNext = DateSerial(year(dt),Month(dt)+1,1)
? format(dtNext,"dddd")
Wednesday
? dtNext
08/01/2007
? format(dtNext,"1\st mmm")
1st Aug


--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote:

demo't from the immediate window:

dt = DateValue("July 23, 2007")
dtNext = DateSerial(year(dt),Month(dt)+1,0)
? format(dtNext,"dddd")
Tuesday
? dtNext
07/31/2007

--
regards,
Tom Ogilvy


"Grd" wrote:

Hi,

I'm struggling to get the function working to figure out the first day of
the following month. So if I have a cell with say 23 July I want my function
to result in 1st Aug.

I need this to be function not a formula cos I'm going to refer to it in my
code.

any help greatly appreciated


Thanks

Suzanne


  #5   Report Post  
Posted to microsoft.public.excel.programming
Grd Grd is offline
external usenet poster
 
Posts: 118
Default Need to create function to find first day of following month

Thanks John

I'll have a look at this and Tom Ogilvy's but I think its what I want

S

"John Bundy" wrote:

see if this is what you want, may have to change sheet and cell ref

startmonth = Month(Sheets(1).Cells(1, 2))
endmonth = startmonth + 1
MsgBox "1st " & MonthName(endmonth)

--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"Grd" wrote:

Hi,

I'm struggling to get the function working to figure out the first day of
the following month. So if I have a cell with say 23 July I want my function
to result in 1st Aug.

I need this to be function not a formula cos I'm going to refer to it in my
code.

any help greatly appreciated


Thanks

Suzanne




  #6   Report Post  
Posted to microsoft.public.excel.programming
Grd Grd is offline
external usenet poster
 
Posts: 118
Default Need to create function to find first day of following month

Hi Tom,

This works nicely for me. I couldn't get this working on my own so thanks
very much

S

"Tom Ogilvy" wrote:

Sorry, had a typo in my dtNext formula and wasn't paying attention:

dt = DateValue("July 23, 2007")
dtNext = DateSerial(year(dt),Month(dt)+1,1)
? format(dtNext,"dddd")
Wednesday
? dtNext
08/01/2007
? format(dtNext,"1\st mmm")
1st Aug


--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote:

demo't from the immediate window:

dt = DateValue("July 23, 2007")
dtNext = DateSerial(year(dt),Month(dt)+1,0)
? format(dtNext,"dddd")
Tuesday
? dtNext
07/31/2007

--
regards,
Tom Ogilvy


"Grd" wrote:

Hi,

I'm struggling to get the function working to figure out the first day of
the following month. So if I have a cell with say 23 July I want my function
to result in 1st Aug.

I need this to be function not a formula cos I'm going to refer to it in my
code.

any help greatly appreciated


Thanks

Suzanne


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
Can I create a macro that works like the "find' function doral Excel Discussion (Misc queries) 15 August 23rd 07 05:02 PM
Create Month Timetable on a worksheet different month each works Courtney Excel Worksheet Functions 1 October 15th 06 11:48 AM
When using MONTH function on Blank Cell!! Returns Month=Jan! mahou Excel Discussion (Misc queries) 6 January 9th 06 02:46 AM
How do I create an equivalent VLOOKUP function using FIND? dan Excel Worksheet Functions 8 August 17th 05 04:43 PM
how do i create a find function for an excel drop list? RC Excel Discussion (Misc queries) 3 March 18th 05 03:09 PM


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

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"