![]() |
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 |
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 |
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 |
All times are GMT +1. The time now is 09:16 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com