+ Reply to Thread
Results 1 to 5 of 5

Format text - Event

  1. #1
    al007
    Guest

    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. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello al007,

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

    Sincerely,
    Leith Ross

  3. #3
    al007
    Guest

    Re: 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. #4
    Patrick Molloy
    Guest

    RE: 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. #5
    al007
    Guest

    Re: Format text - Event

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


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1