Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 137
Default 1st and last date of the month from MonthName

Hello!,

How I could get the starting and ending date of a month based on month
name.

For Eg. say I have combobox1 and textbox1 and textbox2. If i select
january from combobox1 i want to get 1/1/2006 in textbox1 and 31/1/2006
in textbox2 ..

thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default 1st and last date of the month from MonthName

you don't mention how you get the month names into the combobox
this is a simple overview:

i would probably use a rowsource from a sheet with the first day of each month
in a cell

something like Sheet3!A1:a12

then fill and format the combobox with the month name

then textbox 1 could be the value from sheet3!a1
and text box 2 could be this formula
=EOMONTH(A1+1, 0)

or

=EOMONTH(me.textbox1.value +1, 0)






--


Gary


"Abdul" wrote in message
ups.com...
Hello!,

How I could get the starting and ending date of a month based on month
name.

For Eg. say I have combobox1 and textbox1 and textbox2. If i select
january from combobox1 i want to get 1/1/2006 in textbox1 and 31/1/2006
in textbox2 ..

thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 1st and last date of the month from MonthName

Hi Abdul,

Try something like:

'=============
Public Sub Tester()
Dim sStr As String
Dim arr As Variant
Dim iMonth As Long
Dim myDate1 As Date
Dim myDate2 As Date

arr = Array("January", "February", "March", _
"April", "May", "June", "July", _
"August", "September", "October", _
"November", "December")

sStr = "February"
iMonth = Application.Match(sStr, arr, 0)
myDate1 = DateSerial(Year(Date), iMonth, 1)
myDate2 = DateSerial(Year(Date), iMonth + 1, 0)
MsgBox myDate1 & vbNewLine & myDate2

End Sub
'<<=============


---
Regards,
Norman



"Abdul" wrote in message
ups.com...
Hello!,

How I could get the starting and ending date of a month based on month
name.

For Eg. say I have combobox1 and textbox1 and textbox2. If i select
january from combobox1 i want to get 1/1/2006 in textbox1 and 31/1/2006
in textbox2 ..

thanks



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
Date arithmetic: adding 1 month to prior end of month date manxman Excel Worksheet Functions 2 July 14th 06 09:29 PM
Sort month/date/year data using month and date only SMW820 Excel Discussion (Misc queries) 6 June 22nd 06 05:14 PM
=VLOOKUP(1,Nationality!B5:B29,IF(MONTH(date)6,MONTH(date)-6, MON Ali Excel Worksheet Functions 14 January 18th 06 08:20 AM
Determine begin month date from month end date. mikeburg[_59_] Excel Programming 3 January 13th 06 08:42 PM
Convert "Month" to "MonthName" format from db to PivotTable Billabong Excel Programming 1 August 25th 04 09:14 AM


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

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

About Us

"It's about Microsoft Excel"