PC Review


Reply
Thread Tools Rate Thread

Cell justifcation

 
 
ordnance1@comcast.net
Guest
Posts: n/a
 
      19th Sep 2008
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")
 
Reply With Quote
 
 
 
 
OssieMac
Guest
Posts: n/a
 
      19th Sep 2008
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

--
Regards,

OssieMac


"(E-Mail Removed)" wrote:

> 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")
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to export data to fixed width not saving right justifcation IrishRed Microsoft Excel Programming 0 30th Jan 2008 02:24 PM
NEED VBA TO SELECT A CELL; NOTE THE CELL VALUE;COPYADJ CELL;FIND CELL VALUE IN A RANGE AND SO ON CAPTGNVR Microsoft Excel Programming 2 8th Jul 2007 04:18 PM
How to create/run "cell A equals Cell B put Cell C info in Cell D =?Utf-8?B?YWJtYjE2MQ==?= Microsoft Excel Misc 5 26th Jan 2006 06:36 PM
How do you change the justifcation in the normal template? =?Utf-8?B?S2FyZW4=?= Microsoft Word Document Management 2 6th Apr 2005 03:29 PM
JUSTIFCATION OF FIELD NAME AND DATA FIELDS =?Utf-8?B?TVVSVEFaQQ==?= Microsoft Access Forms 0 8th Jun 2004 10:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:14 PM.