Consulting

Results 1 to 14 of 14

Thread: Font color

  1. #1
    VBAX Regular
    Joined
    Jun 2008
    Posts
    41
    Location

    Exclamation color palette add-in

    i need a colour platte on each within a range of cells is there an add-in for this?

  2. #2
    VBAX Regular
    Joined
    Jun 2008
    Posts
    41
    Location

    Exclamation Font color

    how can i right click on an active cell and change the font color of the cell's content without clicking format cells?

  3. #3
    VBAX Tutor
    Joined
    Nov 2007
    Posts
    228
    Location
    Quote Originally Posted by josephm
    how can i right click on an active cell and change the font color of the cell's content without clicking format cells?
    You don't need to right click on the cell to change the interior or font color.

    If you look along your excel toolbar you will see a button for Font Colour and a button for interior color, just click on these and select the color. If you don't see these buttons, right click in your toolbar area click customize, then drag and drop the buttons you need to add

    Marshybid

  4. #4
    VBAX Regular
    Joined
    Jun 2008
    Posts
    41
    Location
    thank you but i do want the user to have to go all the way up there

    isnt there a add-in similar to the pop-up calander?

  5. #5
    VBAX Regular
    Joined
    Mar 2005
    Location
    Helena, MT
    Posts
    90
    Location
    This will toggle the Font between xlAutomatic and Red with a Right Click
    Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
     If Target.Font.ColorIndex = xlAutomatic Then
           Target.Font.ColorIndex = 3
     Else: Target.Font.ColorIndex = xlAutomatic
     End If
     Cancel = True
    End Sub
    I think it best to use a BeforeDoubleClick instead. This maintains your Right Click Menu

    lenze

  6. #6
    VBAX Regular
    Joined
    Jun 2008
    Posts
    41
    Location
    i want the user to pick either red or green. how do i do that using the above code.?

    and from the right click menu how does the user select red or green?

  7. #7
    VBAX Regular
    Joined
    Mar 2005
    Location
    Helena, MT
    Posts
    90
    Location
    I don't understand your question? Can you give an example of your needs?

    lenze

  8. #8
    VBAX Regular
    Joined
    Jun 2008
    Posts
    41
    Location
    [VBA]Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Target.Font.ColorIndex = xlAutomatic Then
    Target.Font.ColorIndex = 3
    Target.Font.ColorIndex = 4
    Else: Target.Font.ColorIndex = xlAutomatic
    End If
    Cancel = True
    End Sub[/VBA]

    i made a change to the code as shown above but then it only toggles between XLautomatic and green it leave out the red.

    i want it to toggle beteen automatic, red and green.

  9. #9
    VBAX Regular
    Joined
    Mar 2005
    Location
    Helena, MT
    Posts
    90
    Location
    Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean
    If Target.Font.ColorIndex = 4 Then
        Target.Font.ColorIndex = 3
    Else: Target.Font.ColorIndex = 4
    End If
    Cancel = True
    End Sub

    You just need to change to the appropriate ColorIndex Number. To see all the CI's on your computer, place this code in a regular modue and run it on a blank sheet


    Sub ShowColorIndex()
       Dim cl As Range
        Dim x As Integer
        x = 0
        Range("$A$3:$A$17").Select
        With Selection
         .HorizontalAlignment = xlCenter
            .VerticalAlignment = xlCenter
            .ColumnWidth = 17.5
            .RowHeight = 20
            .Font.Bold = True
        End With
        For Each cl In Selection
        cl.Value = x
        cl.Interior.ColorIndex = x
        x = x + 1
        Next cl
     
        Range("$C$4:$C$17").Select
        With Selection
         .HorizontalAlignment = xlCenter
            .VerticalAlignment = xlCenter
            .ColumnWidth = 17.5
            .Font.Bold = True
        End With
        For Each cl In Selection
        cl.Value = x
        cl.Interior.ColorIndex = x
        x = x + 1
        Next cl
     
        Range("$E$4:$E$17").Select
        With Selection
         .HorizontalAlignment = xlCenter
            .VerticalAlignment = xlCenter
            .ColumnWidth = 17.5
            .Font.Bold = True
        End With
        For Each cl In Selection
        cl.Value = x
        cl.Interior.ColorIndex = x
        x = x + 1
        Next cl
     
        Range("$G$4:$G$17").Select
        With Selection
         .HorizontalAlignment = xlCenter
            .VerticalAlignment = xlCenter
            .ColumnWidth = 17.5
            .Font.Bold = True
        End With
        For Each cl In Selection
        cl.Value = x
        cl.Interior.ColorIndex = x
        x = x + 1
        Next cl
     
        Range("$D$1").Select
        Selection = "COLORINDEX"
        Selection.Font.Bold = True
        Selection.HorizontalAlignment = xlCenter
        Selection.ColumnWidth = 17.5
    End Sub
    lenze

  10. #10
    VBAX Regular
    Joined
    Mar 2005
    Location
    Helena, MT
    Posts
    90
    Location
    If you want to toggle between xlAutomatic, Red, And Green, try this
    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Target.Font.ColorIndex = 4 Then
         Target.Font.ColorIndex = 3
         Cancel = True
         Exit Sub
     End If
     If Target.Font.ColorIndex = 3 Then
          Target.Font.ColorIndex = xlAutomatic
          Cancel = True
          Exit Sub
     End If
     Target.Font.ColorIndex = 4
     Cancel = True
    End Sub
    lenze

  11. #11
    VBAX Regular
    Joined
    Mar 2008
    Posts
    37
    Location
    This will also work

    [vba]
    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Target.Font.ColorIndex = 4 Then
    Target.Font.ColorIndex = 3
    Cancel = True
    ELSEIF Target.Font.ColorIndex = 3 Then
    Target.Font.ColorIndex = xlAutomatic
    Cancel = True
    ELSEIF Target.Font.ColorIndex = xlAutomatic Then
    Target.Font.ColorIndex = 4
    Cancel = True
    End If

    End Sub
    [/vba]

  12. #12
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Const WS_RANGE As String = "H1:H10" '<== change to suit

    On Error GoTo ws_exit
    Application.EnableEvents = False

    If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
    With Target

    Application.Dialogs(xlDialogPatterns).Show
    End With
    End If

    ws_exit:
    Application.EnableEvents = True
    End Sub
    [/vba]

    This is worksheet event code, which means that it needs to be
    placed in the appropriate worksheet code module, not a standard
    code module. To do this, right-click
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  13. #13
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    See my post in your other thread.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  14. #14
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Joseph,
    Why do you guys insist on taking the Bart Simpson approach to asking questions? Asking the same question in mutiple threads only turns people away from helping you. I have merged your identical thread questions and in the future please stick to one question/one thread.

    How would you feel if you spent the time to research and respond to someone's question only to find out that they had posted the same question in a different thread and already had an answer.....you would probably not want to help them in the future would you?

    Please be considerate of our contributors.....you are not the only one with a question and your question is darn sure not more important than everyone elses......

    We like to run a friendly board here so we will insist that you behave and be courtious and gratious when you do receive the help you are here asking for.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

Posting Permissions

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