Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Macro help with date entry

0

Hellow Forum,

I need help writing a VB code to do a following:

  1. Macro has to prompt the user to enter start time
  2. Enter the value in cell A9
  3. Macro has to prompt the user to enter end time
  4. Enter the value in cell B9
  5. Macro has to prompt the user to enter Product number
  6. Enter the value in cell C9

I can figure out the rest from this point on.

Thank you in advance.

Answer
Discuss

Answers

0
Selected Answer

Your request is quite complicated and not sufficiently specified in some regards. However, I have created a pleasant little program, I think, which I hope you will enjoy. Its drawback is that I didn't take the time to test it thoroughly. For example, setting the variable AmPmHoursFalse (in the Declarations module) hasn't been tested at all. Please do and feel free to point out glitches.

The program is in the attached workbook. Find instructions to get you going on the sheet you see when you open the file. Look for some help to effect modifications in the comments in the code.

Discuss

Discussion

Hi 
It worked like a charm. Thank you for your help.
scorpion831 (rep: 2) Oct 31, '19 at 3:06 pm
Hi Scorpion,
I'm glad to learn that my macro worked for you. It might be a little early, however, to declare victory. Bugs may not announce themselves until you have used it for a while. I forgot to tell you that both AM/PM fields in the middle of the form change on single click. Enter 15:30 as a time to have the macro convert it to "3:30 PM" (subject to the setting of the AmPmHourse variable). Then click on the "PM" to convert it to "AM" and v.v.
Variatus (rep: 4889) Oct 31, '19 at 7:35 pm
Add to Discussion


Answer the Question

You must create an account to use the forum. Create an Account or Login