Excel macro time formatting

  Chris the Ancient 15:24 13 Nov 2007
Locked

What little hair is left is fast disappearing!

I am using, as part of an Excel macro, a cell to show when the macro was run.

However, when I use the statement...

ActiveCell = Date & " " & Time
With Selection.Font
.Size = 9
.ColorIndex = 3
End With

... the cell gives me the date in dd/mm/yyyy hh:mm:ss format.

I would rather have dd/mm/yy hh:mm:ss as the format (takes kess room).

Despite trawling through various items in the help (help?) facility, I cannot really see how to do it.

I know it must be simple - so simple that I'm missing the bloomin' obvious!

So, can I have some sensible help please before my hairdresser loses my custom?

  Chris the Ancient 15:26 13 Nov 2007

takes less room

  johnnyrocker 15:33 13 Nov 2007

from reading your post it would appear the formula is giving you what you want?




johnny.

  Chris the Ancient 15:39 13 Nov 2007

Pudgy fingers strike again!

I want dd/mm/yy (short year)

and

dd/mm/yy hh:mm (without the :ss)

I just KNEW that bit of code was getting to me!

  silverous 16:54 13 Nov 2007

These do you ?

ActiveCell = Format(Now,"dd/mm/yy")

ActiveCell = Format(Now,"dd/mm/yy hh:mm")

  Chris the Ancient 17:15 13 Nov 2007

Spot wottsit on!

I just knew that there had to be a simple solution!

Many thanks

CtA

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Xiaomi Mi Mix 2 review

Halloween Photoshop & Illustrator tutorials: 20 step-by-step guides to creating spook-tacular…

iPhone X news: Release date, price, new features & specs

Comment créer, modifier et réinitialiser un compte Apple ?