Cell justifcation

O

ordnance1

Below is a snippet of code which puts a : in a number in the cell and
it works great. My problem is that when it does this it changes the
cell justification from Centered to Left justifed. Any way around
this?

If Target.Count=1 And Not Application.Intersect(_
Me.Range("E3:G87"), Target) Is Nothing Then
Application.EnableEvents=False
If IsNumeric(Target.Value) And InStr(Target.Value, ":")=0_
And Len(Target.Value) <5 Then
Target.Value=Format$(Target.Value, "00\:00")
 
O

OssieMac

I am surprised that it changes the justification but to overcome it just add
the following line of code and reset the justification.

Target.HorizontalAlignment = xlCenter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top