+ Reply to Thread
Results 1 to 4 of 4

Thread: Cell formatting automatically

  1. #1
    Registered User
    Join Date
    10-31-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    7

    Cell formatting automatically

    Hi,

    I would like to know if there is a macro i can use so that when i type 'u100' in a cell and hit enter, the 'u' automatically changes to an up arrow and the text turns green. Likewise, when i type d100, it replaces the d with a down arrow and the text turns red...

    u (up) for green
    d (down) for red

    I guess the u and d being replaced by corressponding arrows would be similar to autocorrect, but i woud also like the text to change colour per above.

    Not sure if this is possible or not... And if it is, i have no idea how to code it!!

    Any suggestions welcome. Thanks!

  2. #2
    Valued Forum Contributor
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    Excel 2010
    Posts
    522

    Re: Cell formatting automatically

    Hi morayman
    Try to enter values ​​in D2:D20
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Count > 1 Then Exit Sub
    If Intersect(Target, [d2:d20]) Is Nothing Then Exit Sub
    If Not Target Like "[ud]*" Then Target.Font.Name = "Arial": Target.Font.Color = vbBlack: Exit Sub
    Application.EnableEvents = False
    Target.Font.Name = "Arial"
    With Target.Characters(1, 1)
        .Font.Name = "Marlett"
        .Text = IIf(.Text = "u", "t", "u")
        Target.Font.Color = IIf(.Text = "u", vbRed, vbGreen)
    End With
    Application.EnableEvents = True
    End Sub
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    10-31-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Cell formatting automatically

    awesome.. thanks so much

  4. #4
    Forum Guru ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    traded up
    MS-Off Ver
    2003 & 2010
    Posts
    1,905

    Re: Cell formatting automatically

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save
    “To sin by silence when they should protest makes cowards of men.” ~ Abraham Lincoln

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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.2.0