MrExcel Publishing
Your One Stop for Excel Tips & Solutions

last post went astray please assisted


Posted by tessa gazzard on December 20, 2001 4:34 PM

did all readytpost this question but it seems to have disapeared
Anyway i am very new to vba but have some grate books and spend alot of time stiding anyway i amtrying tohave a sheet that onopeening would display a input box that would askfor a name and date of birth and maybe a space for today date touse in the calcalations withthis info i would like to be able to work out how old in days the person is and what day oftheweek they wereborn on i would like the info collected and result of caculations to be displayed on the next avalible row in sheet which would have corrosponing headings ect Name, D.O.B age in days, Born On A Date of Questionaire "date information was entered" any help apriated especially with the caculation within the code sorry about the post but my spacebar is playing up


Posted by Jacob on December 20, 2001 6:00 PM

Hi

This should help you out.

put this code in the worksheet event area for the sheet you want.

Private Sub Worksheet_Activate()


Dim DOB
Dim Name

DOB = InputBox("When were you born?")
Name = InputBox("What is your name?")

MsgBox ("Hello " & Name & " you were born on a " & Application.WorksheetFunction.Text(DOB, "DDDD"))

End Sub

Hope this helps

Jacob

Posted by tessa gazzard on December 20, 2001 6:33 PM

yes that does help but how do i get it to record the information on to sheet1 as well having the message displayed in a box and where would i put the code for that part thank you once again it for a project that i am setting for my childrens education and it help if the teacher can do it

Posted by Jacob on December 20, 2001 7:44 PM

You can add this to the rest of the code.

lets say you want to put the info in A1

range("A1").formular1c1 = DOB

or

sheet1.activate
range("A1").select
activecell.formulaR1C1 = DOB

Jacob