Excel VBA Input Box for Dates - Code Included

preview_player
Показать описание
Grab the Free VBA Quick Reference Guide
In this Video we use use the input box to collect a date and validate that a date is entered

Code
Sub InputboxStuff()
Dim dte As Date
mbox = InputBox("Enter a date", "Dates are cool")

If IsDate(mbox) Then
dte = CDate(mbox)
Range("C9") = dte
Else
MsgBox "This isn't a date. Try Again"

End If

End Sub
Рекомендации по теме
Комментарии
Автор

Waht about eidting tables by loking the date column or deleting data by looking the date column?

karitapirhonen
Автор

Sir,
if i text box2 input time is less then input textbox1, then give error msg in excel... exm textbox1= 00:20, textbox2=23:30... then give error msg .

KnowEverythin
Автор

hi sir. i wanna ask if you can give us an input box to filter specific date? hope you can. thank you

nhielapostol
Автор

Great Video!!!. I have many ranges in a form. i want to color the cell to show that are required. if the cell has data, no color but if the cell is blank, color the cell. Also, I want to format a number to a date (like access)? if I enter a number 121519, it will give me 12/15/19 or If I enter 12/15/19 it will give me the same things.. Thanks in advance.

kaaa
Автор

Hi! Can you please help me with this date issue i have? i have 2 cells where dates are entered ...lets say cell B4 and cell C4. B4 is manufacturing date and C4 is expiry date. I need to check through a code that C4 is not equal to today, C4 is greater than today and B4. B4 is not equal to today, and B4 is less than today.

Can you please help me with the code. i am very new to VBA excel coding. I am using Excel 2016, 32 bit version.

dasindira
Автор

I need your help again: how should I proceed to substitute the Date with a custom number on format "##.##", to be inserted like "12.45"? Thanx!

gabrieldionisierotar
Автор

Do VBA supports British date format? or is it US format only

incredible
Автор

Obviously you are not a teacher. Please do improve your method of teaching. Be more organized in presenting tutorials. Thanks for taking into account my opinion.

JosephArouna
welcome to shbcf.ru