Repost
I really don’t use USERFORMS, but try

Private Sub CommandButton1_Click()
txtdor.Text = DateSerial(Year(txtdob.Text) + 60, Month(txtdob.Text) + 1, 0)
End Sub

From: dguillett1 
Sent: Monday, September 12, 2011 1:04 PM
To: excel-macros@googlegroups.com 
Subject: Re: $$Excel-Macros$$ date difference

I am an advocate of the KISS (keep it simple stupid-not meant personally) so 
stick with my original offering.

From: Shankar Bheema 
Sent: Monday, September 12, 2011 10:58 AM
To: excel-macros@googlegroups.com 
Subject: Re: $$Excel-Macros$$ date difference

but i am using userform na sir. So pls see my attachment and i am not 
understanding the mistake i did in my code


On Mon, Sep 12, 2011 at 9:07 PM, dguillett1 <dguille...@gmail.com> wrote:

        Why not just a simple formula for a dob in cell d11

        =DATE(YEAR(D11)+60,MONTH(D11)+1,0) 


  From: Shankar Bheema 
  Sent: Monday, September 12, 2011 9:54 AM
  To: excel-macros@googlegroups.com 
  Subject: $$Excel-Macros$$ date difference

  Hai all, 

  I am attaching an excel userform which contains Dateof Birth textbox and Date 
of Retirement textbox.

  Conditions are:

  i) Date of Retirement should be 60 years after Date of Birth
  eg. if date of birth is in the year 1960 date of retirement would be 2020

  ii) Date of retirement would be last  day of the month

  if date of birth is on 28-04-1981 then date of retirement would in the last 
day of the April month i.e. 30-04-2041

  iii) if the date of retirement falls in the month of February and if it is a 
leap year then the retirement date would be 29th feb.

  iv) If date of birth fells on 1st of the month the retirement date would be 
the last day of the last month
  eg. if Dob is 01-01-2012 then the date of retirement would be 31-12-2011.

  I have written code for that but its not throwing errors.  if there is any 
simplest way may kindly be suggest.
  -- 
  
----------------------------------------------------------------------------------
  Some important links for excel users:
  1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
  2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
  3. Excel tutorials at http://www.excel-macros.blogspot.com
  4. Learn VBA Macros at http://www.quickvba.blogspot.com
  5. Excel Tips and Tricks at http://exceldailytip.blogspot.com

  To post to this group, send email to excel-macros@googlegroups.com
   
  <><><><><><><><><><><><><><><><><><><><><><>
  Like our page on facebook , Just follow below link
  http://www.facebook.com/discussexcel

  -- 
  
----------------------------------------------------------------------------------
  Some important links for excel users:
  1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
  2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
  3. Excel tutorials at http://www.excel-macros.blogspot.com
  4. Learn VBA Macros at http://www.quickvba.blogspot.com
  5. Excel Tips and Tricks at http://exceldailytip.blogspot.com

  To post to this group, send email to excel-macros@googlegroups.com
   
  <><><><><><><><><><><><><><><><><><><><><><>
  Like our page on facebook , Just follow below link
  http://www.facebook.com/discussexcel


-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com

To post to this group, send email to excel-macros@googlegroups.com
 
<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel

Reply via email to