Тёмный

Enter Date In Excel Without The Slash - Type Only The Number - Excel VBA Is Fun 

ExcelVbaIsFun
Подписаться 98 тыс.
Просмотров 12 тыс.
50% 1

Опубликовано:

 

8 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 29   
@011Harrisa
@011Harrisa 6 лет назад
This is a great relatively unused part of vba that most people don’t use. I can think of some great uses for key strokes, so thank you for that. One additional piece that I think the coder is going to have to solution for is when the date is a single digit day and month. For example, 1/1/2018. This date here would break your code because now the lengths have changed. It’s relatively easy to solution for that, either evaluate the various lengths dynamically or put in a function to force the 0 before evaluating the lengths. In this case 1/1/2018 becomes 01/01/2018, then you evaluate. Just a small issue I could see with this code. Really great stuff here and I always enjoy picking up new tricks from you!
@ExcelVbaIsFun
@ExcelVbaIsFun 6 лет назад
Very, very good points!! You're 100% correct, this method assumes the user is always going to type using MM/DD/YYYY format, so if they wanted January 8, 2019, they would have to be sure to type '01082019' into the textbox. Brilliant observation and thanks so much for your kind words!!
@garethl665
@garethl665 6 лет назад
how do i put this on my work sheet it works but how to activate so all dates typed in a coloum go like this
@excelisfun
@excelisfun 6 лет назад
Thanks for the awesome video!!!!
@ExcelVbaIsFun
@ExcelVbaIsFun 6 лет назад
ExcelIsFun thank you, ExcelIsFun!
@valdereiantunes
@valdereiantunes 6 лет назад
Dan, thanks for your explanation, this video is awesome and even thought I was not an American and my English was a little rusty, I could understand. Did you have earned a new subscriber.
@ExcelVbaIsFun
@ExcelVbaIsFun 6 лет назад
Glad to have to, Valderei! Thanks for the comments!!
@jagans9310
@jagans9310 6 лет назад
Thanks you so much, Awesome video, this will help me lot .....
@ExcelVbaIsFun
@ExcelVbaIsFun 6 лет назад
Jagan S So glad it helped!!
@Angel_268
@Angel_268 5 лет назад
can i do this in a cell instead of a UI
@rajeshmajumdar4999
@rajeshmajumdar4999 6 лет назад
Very nice!!!
@ExcelVbaIsFun
@ExcelVbaIsFun 6 лет назад
Thanks, Rajesh!
@krn14242
@krn14242 6 лет назад
Great video Daniel.
@ExcelVbaIsFun
@ExcelVbaIsFun 6 лет назад
Kevin, you are always so encouraging! Thanks, buddy!
@garethl665
@garethl665 6 лет назад
how do i put this on my work sheet it works but how to activate
@malblawi2448
@malblawi2448 4 года назад
Thank you or this great tutorial , can the slash show before write month , i mean show automatically before user write the second part. thank you so much.
@surjagain
@surjagain 6 лет назад
Thanks for this video upload and I really enjoy going through your Excel VBA course on Udemy, there's a lot to learn there. :)
@ExcelVbaIsFun
@ExcelVbaIsFun 6 лет назад
Thanks S Gain! That's really wonderful. Glad to have you!
@jaumefp
@jaumefp 6 лет назад
Great job , As it could be forced to that the form accepts only digits valid for the month 1 to 12 and from 1 to 31 for the days?
@ExcelVbaIsFun
@ExcelVbaIsFun 6 лет назад
Jaume Fornos Pinos Yep, there's lots of validation one could use. I would start by using the Mid() function in order to grab the first 2, middle 2 and last 4 during keystrokes.
@jaumefp
@jaumefp 6 лет назад
I'm go to try it, thanks.
@rockguitarist8907
@rockguitarist8907 6 лет назад
I’d like to know why when you input three characters into the Me.TextBox1, the IF returns true and executes the “/“ after your third char input when you input “=2” as the condition. It seems the criteria should be “>=2”. Are IF statements just different for Textboxes? Thank you.
@ExcelVbaIsFun
@ExcelVbaIsFun 6 лет назад
WOW! Excellent question. So here's the scoop - when a KeyDown event like this runs, it does not include the actual key pressed in the code. What I mean by that is it's as if the key has not officially been pressed and inserted into the textbox or control until the code has run to completion. Then after you've analyzed or done whatever you want to enhance or even block certain keystrokes (KeyCode = False), then the key may be allowed to run (if you choose). It's kind of like a security guard choosing whether to allow someone into a club. You choose whether the keystroke gets to come through or not. So if you have 2 chars in the textbox and you type a 3rd, the Len() function will only analyze the current length prior to this keystroke coming through. I may have beaten that point to death, sorry if so. Awesome question, rockguitarist!! Thanks Dan
@jimmys4189
@jimmys4189 3 года назад
I'm creating a shelf location form for merchandise but when I search for the item if the # of the item starts with a 0, the # will come up without the 0. my question is: is there's a way that if you have a leading 0 in a cell, you can have it display in the textbox as 012345 not 12345
@ExcelVbaIsFun
@ExcelVbaIsFun 3 года назад
Hi jimmy, Excellent question! It should work if you use the cell's .TEXT property instead of .VALUE, which is the default and probably why it's not been working. me.Textbox1 = Range("a1").TEXT Thanks Dan
@ravishankar9289
@ravishankar9289 2 года назад
Simple thing described in pathetic way
@ExcelVbaIsFun
@ExcelVbaIsFun 2 года назад
Cool! Thanks for the special comment!
@emilvichev5920
@emilvichev5920 6 лет назад
Very nice!!!!
@ExcelVbaIsFun
@ExcelVbaIsFun 6 лет назад
Thanks, Emil!
Далее
IT'S MY LIFE + WATER  #drumcover
00:14
Просмотров 22 млн
кого отпустят гулять чееек
00:53
Excel Tips - Converting a Text String to a Date
5:03
Просмотров 121 тыс.
5 Things I wish I knew When I started using Excel VBA
12:45
How to get the Last Row in VBA(The Right Way!)
15:41
Просмотров 158 тыс.
Excel VBA Introduction Part 55.1 - Working with Dates
46:57
IT'S MY LIFE + WATER  #drumcover
00:14
Просмотров 22 млн