Re: $$Excel-Macros$$ datediff problem

2011-09-16 Thread Shankar Bheema
THANK YOU SO MUCH SAM. On Fri, Sep 16, 2011 at 6:50 AM, Sam Mathai Chacko wrote: > Not sure if you can. But you can use this > > Private Sub ComboBox9_Change() > > Dim dtmStart As Date > Dim dtmEnd As Date > > If Day(CDate(TextBox1.Text)) > 12 Then > dtmStart = CDate(TextBox1.

Re: $$Excel-Macros$$ datediff problem

2011-09-15 Thread Sam Mathai Chacko
Not sure if you can. But you can use this Private Sub ComboBox9_Change() Dim dtmStart As Date Dim dtmEnd As Date If Day(CDate(TextBox1.Text)) > 12 Then dtmStart = CDate(TextBox1.Text) Else dtmStart = DateSerial(Year(CDate(TextBox1.Text)), Day(CDate(TextBox1.Text))

Re: $$Excel-Macros$$ datediff problem

2011-09-15 Thread Shankar Bheema
cant we change it for indian format ? On Thu, Sep 15, 2011 at 8:43 PM, NOORAIN ANSARI wrote: > Dear Bheema, > > > Please try it..and see attached sheet.. > ** > *Private Sub TextBox2_Exit(ByVal Cancel As MSForms.ReturnBoolean) > TextBox17.Text = VBA.DatePart("m", CDate(TextBox2.Text)) - >

Re: $$Excel-Macros$$ datediff problem

2011-09-15 Thread NOORAIN ANSARI
Dear Bheema, Please try it..and see attached sheet.. ** *Private Sub TextBox2_Exit(ByVal Cancel As MSForms.ReturnBoolean) TextBox17.Text = VBA.DatePart("m", CDate(TextBox2.Text)) - VBA.DatePart("m", CDate(TextBox1.Text)) End Sub * -- Thanks & regards, Noorain Ansari *http://excelmacrowo

Re: $$Excel-Macros$$ datediff problem

2011-09-15 Thread rajan verma
On 15/09/2011, Sam Mathai Chacko wrote: > Shankar, > > The problem with date conversions of text formats to date formats in visual > basic 6 and VBA is that by default, it considers date as mm/dd/, and not > like the Indian version dd/mm/. In your case, 01-02-2011 is converted or > seen as

Re: $$Excel-Macros$$ datediff problem

2011-09-15 Thread Sam Mathai Chacko
Shankar, The problem with date conversions of text formats to date formats in visual basic 6 and VBA is that by default, it considers date as mm/dd/, and not like the Indian version dd/mm/. In your case, 01-02-2011 is converted or seen as 2nd January 2011. To avoid this, use dd-mmm- fo

$$Excel-Macros$$ datediff problem

2011-09-15 Thread Shankar Bheema
hai all, I am attaching my excel sheet userform. I am getting wrong result of months in different way. for example : Actual months difference between 01-02-2011 and 30-06-2011 are 5 months but the result coming as 4 pls provide solution -- -