Excel VBA - msgbox asking for date.

S

stevieh

Hi All,

I want to be able to use a msgbox that asks a person what date it is?

When the person enters say 19/08/04 and presses ok, another spreadshee
willl now have this date entered.

What im trying to do is in the end is be able to write the date in an
sleect a task. So each time i do a task i can say what day and how man
times.

Any help would be great Im novice at best.:
 
F

Frank Kabel

Hi
try something like the following:
Sub foo()
Dim res_value
Dim target_wks As Worksheet
Set target_wks = ActiveWorkbook.Worksheets("Tabelle2")

Do
res_value = InputBox("Please enter a date")
Loop Until IsDate(res_value)
With wks.Range("A1")
.Value = DateValue(res_value)
.NumberFormat = "MM/DD/YYYY"
End With

End Sub
 
S

stevieh

thanks for your quick reply,

So i can now enter the date which I was able to do before. I dont thin
I explained very well what I want to do.

After entering the date and pressing return, the date enters in say a1
then when say the following days date is entered it enters this in a
etc etc.

cheers

stev
 
F

Frank Kabel

Hi
why not use a formula in cell A2, etc. for this. e.g.
=A1+1
and format this cell A2 as date?
 
S

stevieh

good idea but my final thing will be that a person enters the date, the
activity (at work etc) and where they are .

After they do that the spreadsheet will allocate the info accordingly

e.g they enter 1/01/04, golf, germany

the spreadsheet finds this date and under the date adds the task,

should i send an example??
 
Top