LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default Another Userform Date Problem

Hi

I have a Userform that enters data onto a "Members" sheet one of the
TextBoxes is for members DOBirth now as you all known some ladies are
reluctant to give out that sort of information and I tend to get round it by
entering 01/01/07 and the everything works ok, if I forget to enter the date
because the cell is empty on the sheet I get an error. the code below will
hopefully show why


Private Sub Lb1_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Members")

rownum = Lb1.ListIndex
UserForm1.Tb30.Value = Lb1.List(, 0)
UserForm1.Tb31.Value = Lb1.List(, 1)
UserForm1.Tb32.Value = Lb1.List(, 2)
UserForm1.Tb33.Value = Lb1.List(, 3)
UserForm1.Tb34.Value = Lb1.List(, 4)
UserForm1.Tb35.Value = Lb1.List(, 5)
UserForm1.Tb26.Text = Lb1.List(, 6)
UserForm1.Tb27.Text = Lb1.List(, 7)
UserForm1.Tb28.Text = Lb1.List(, 8)
UserForm1.Tb29.Value = Lb1.List(, 9)
UserForm1.Tb30A.Value = Lb1.List(, 10)
UserForm1.Tb31A.Value = Lb1.List(, 11)
UserForm1.Tb32A.Value = Lb1.List(, 12)
UserForm1.Tb33A.Value = Lb1.List(, 13)
UserForm1.Tb34A.Value = Lb1.List(, 14)
UserForm1.Tb35A.Value = Lb1.List(, 15)

UserForm1.Tb8.Value = Year(Date) - Year(Tb26) <<<<<<< the error occurs here
because no date is in the cell - what this does is tell me how old the member
is and how much he / she should be charged for membership based on their age.
UserForm1.Tb10.Value = Year(Date) - Year(Tb27)

Tb26.Text = Format(Tb26, "dd/mm/yy")
Tb27.Text = Format(Tb27, "dd/mm/yy")
Tb28.Text = Format(Tb28, "dd/mm/yy")
End Sub

What would I need to add to keep the code running even if the cell was empty??
--
Many thanks

hazel
 
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
Userform from a Userform Problem Adrian Excel Programming 1 October 12th 05 04:57 PM
Userform date format problem jennie Excel Programming 2 July 30th 04 01:49 PM
Date in userform being saved as general not date which affects sor Michael Malinsky[_3_] Excel Programming 0 July 28th 04 06:58 PM
Userform to select start date and end date Johnny B. Excel Programming 0 November 28th 03 05:56 PM
Userform Textbox - Date Problem universal[_6_] Excel Programming 2 November 26th 03 04:31 PM


All times are GMT +1. The time now is 06:32 AM.

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"