CREATE INPUTBOX

verluc

Well-known Member
Joined
Mar 1, 2002
Messages
1,451
I want to create an inputbox for a date like 08.05.2002
After used the OK button then this date must automatickly insert in Cell C4
Who can help me to create such an inputbox?
Many thanks
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Hello,

How about this?

Code:
Sub GetDate()
Dim vDate As Variant
Do
    vDate = InputBox("Please enter a date dd/mm/yy", "Get date")
Loop Until IsDate(vDate) Or vDate = ""

If vDate = "" Then Exit Sub

ActiveSheet.Range("C4").Value = CDate(vDate)
End Sub

HTH,
Dan
 
Upvote 0
On 2002-05-08 04:44, dk wrote:
Hello,

How about this?

Code:
Sub GetDate()
Dim vDate As Variant
Do
    vDate = InputBox("Please enter a date dd/mm/yy", "Get date")
Loop Until IsDate(vDate) Or vDate = ""

If vDate = "" Then Exit Sub

ActiveSheet.Range("C4").Value = CDate(vDate)
End Sub
Thanks Dan,it works fine.But how can I display this inputbox by opening of the workbook.
Thanks
HTH,
Dan
 
Upvote 0
OK,

right click the lower of the two Excel icons at the top left of the screen and choose View Code. Then paste this:-

Private Sub Workbook_Open()
Dim vDate As Variant
Do
vDate = InputBox("Please enter a date dd/mm/yy", "Get date")
Loop Until IsDate(vDate) Or vDate = ""

If vDate = "" Then Exit Sub

ActiveSheet.Range("C4").Value = CDate(vDate)
End Sub

HTH,
Dan
 
Upvote 0

Forum statistics

Threads
1,213,560
Messages
6,114,309
Members
448,564
Latest member
ED38

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top