Avatar of Kiwi-123
Kiwi-123
 asked on

Userform help

Please can you help with the attached?

If I press the command button, I'd like for the userform to insert the Date & Time into the active/highlighted cell.

Format would be "dd/mm/yy HH:MM" which is both taken from textbox 1&2

So once the "Add" button is pressed, the value is entered into whatever active cell on the worksheet.



Book1.xls
Microsoft ExcelVB ScriptVisual Basic Classic

Avatar of undefined
Last Comment
als315

8/22/2022 - Mon
als315

Test sample
Book1.xls
Kiwi-123

ASKER
Thanks for your help, seems to work very well. Although two things I noticed is that I get an error message if I put the wrong time in i.e "weer"

The second is that on input it would be great if the next cell is selected to the right. Currently the cursor goes anywhere.
ASKER CERTIFIED SOLUTION
als315

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
als315

Add string
        .Cells(.Rows.Count, .Columns.Count + 1).Select
after string
        .Cells(.Rows.Count, .Columns.Count).Value = D
for selection of next cell
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Kiwi-123

ASKER
Many thanks for your help Als!

I still get the "weer" problem in textbox 2 if I acknowledge the "Please enter valid time" and then press ADD.
als315

Additional checking was added
Book1.xls