![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Posts: 1,288
|
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 |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Sydney, Australia
Posts: 2,908
|
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
Dan |
|
|
|
|
|
#3 | |
|
Board Regular
Join Date: Mar 2002
Posts: 1,288
|
Quote:
|
|
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Sydney, Australia
Posts: 2,908
|
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 |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|