Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 118
Default Format text - Event

Looking for a worksheet event code which would format text entry in
cells as follows:

..HorizontalAlignment = xlJustify
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False

Can anybody help

Thxs

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Format text - Event


Hello al007,

You can create a new Style for the Workbook. Your Style then become
the default for all worksheets, eliminating redundant worksheet even
code.

Sincerely,
Leith Ros

--
Leith Ros
-----------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846
View this thread: http://www.excelforum.com/showthread.php?threadid=48808

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 118
Default Format text - Event

I'm already using a style with cells formatted as custom numbers &
can't have both in text.
That's why I was thinking about a worksheet event - can u help pls
thxs

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Format text - Event

you could use the worksheet's CHANGE event. This is fired when teh ENTER key
is pressed. The 'Target' variable is teh cell or cells changed. Since I want
to avoid formatting numbers, I want to test for them, The Target.Range("A1")
ensures that I test the first cell if more than one cell was enterrd.

Paste this code into the worksheet's code page. Tip: a quick way to the code
page is to select it from the pop-up menu that appears when you RIGHT-Click
thesheet tab...

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

If Not IsNumeric(Target.Range("A1")) Then

With Target

.HorizontalAlignment = xlJustify
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False

End With

End If

End Sub


"al007" wrote:

Looking for a worksheet event code which would format text entry in
cells as follows:

..HorizontalAlignment = xlJustify
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False

Can anybody help

Thxs


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 118
Default Format text - Event

Thxs very much !!!!!!!!!!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with converting CUSTOM format/TEXT format to DATE format Deo Cleto Excel Worksheet Functions 6 June 2nd 09 08:14 PM
Trigger Event on Format Change Zone[_3_] Excel Discussion (Misc queries) 4 August 25th 07 05:43 PM
Format Painter and Worksheet Change Event Gap Excel Programming 1 February 28th 05 07:09 PM
Format Event Trigger (XL2002) Ronald Dodge Excel Programming 2 April 27th 04 09:48 PM
temporary cell format event Tom Ogilvy Excel Programming 3 September 10th 03 06:37 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"