+ Reply to Thread
Results 1 to 3 of 3

multiple text colors in a cell

  1. #1
    Gary Keramidas
    Guest

    multiple text colors in a cell

    the code below enters a name in a blank cell with a space at the end. if there's
    a name with a space, it put's a - after it and adds another name. the else adds
    a cr and another name and a space, so i get 2 names per line. with a dash
    between 2 names.

    the authleave just adds an * if needed. the pre contains either lcase(fname) or
    ucase(fname), based on another variable, so i get upper and lower case names to
    make the distinction.

    if i wanted to use text colors, how could i assign a text color instead of upper
    or lower case, when the variable is encountered ? if it's too difficult, just
    let me know and don't worry about it, this will suffice for my needs.


    With Workbooks(Curbook).Worksheets(Cursheet).Cells(Day(OfSetVal) + 3, m + 1)
    If .Value = "" Then
    .Value = Left(pre, Len(fname) - 4) & authLeave & " "
    ElseIf Right(.Value, 1) = " " Then
    .Value = Left(.Value, Len(.Value) - 1) & "-" & Left(pre, Len(fname) - _
    4) & authLeave
    Else
    .Value = .Value & Chr(10) & Left(pre, Len(fname) - 4) & authLeave & " "
    End If
    End With


    Gary




  2. #2
    Gary''s Student
    Guest

    RE: multiple text colors in a cell

    I don't know if this is of any help, but once you have constructed .Value you
    can color characters in it with:

    Cells(1, 1).Characters(Start:=5, Length:=1).Font.ColorIndex = 3

    Instead of Cells(1,1) use you range
    --
    Gary's Student


    "Gary Keramidas" wrote:

    > the code below enters a name in a blank cell with a space at the end. if there's
    > a name with a space, it put's a - after it and adds another name. the else adds
    > a cr and another name and a space, so i get 2 names per line. with a dash
    > between 2 names.
    >
    > the authleave just adds an * if needed. the pre contains either lcase(fname) or
    > ucase(fname), based on another variable, so i get upper and lower case names to
    > make the distinction.
    >
    > if i wanted to use text colors, how could i assign a text color instead of upper
    > or lower case, when the variable is encountered ? if it's too difficult, just
    > let me know and don't worry about it, this will suffice for my needs.
    >
    >
    > With Workbooks(Curbook).Worksheets(Cursheet).Cells(Day(OfSetVal) + 3, m + 1)
    > If .Value = "" Then
    > .Value = Left(pre, Len(fname) - 4) & authLeave & " "
    > ElseIf Right(.Value, 1) = " " Then
    > .Value = Left(.Value, Len(.Value) - 1) & "-" & Left(pre, Len(fname) - _
    > 4) & authLeave
    > Else
    > .Value = .Value & Chr(10) & Left(pre, Len(fname) - 4) & authLeave & " "
    > End If
    > End With
    >
    >
    > Gary
    >
    >
    >
    >


  3. #3
    Gary Keramidas
    Guest

    Re: multiple text colors in a cell

    thanks, i was able to do that earlier, but it didn't meet the criteria of the
    variable that put the name there in upper or lower case. i could color the 1st
    entry one color, the 2nd another and so on, but the first entry isn't always the
    same criteria.

    --


    Gary


    "Gary''s Student" <GarysStudent@discussions.microsoft.com> wrote in message
    news:18B09268-F0A6-4ACA-9B6A-F86F1E088B3D@microsoft.com...
    >I don't know if this is of any help, but once you have constructed .Value you
    > can color characters in it with:
    >
    > Cells(1, 1).Characters(Start:=5, Length:=1).Font.ColorIndex = 3
    >
    > Instead of Cells(1,1) use you range
    > --
    > Gary's Student
    >
    >
    > "Gary Keramidas" wrote:
    >
    >> the code below enters a name in a blank cell with a space at the end. if
    >> there's
    >> a name with a space, it put's a - after it and adds another name. the else
    >> adds
    >> a cr and another name and a space, so i get 2 names per line. with a dash
    >> between 2 names.
    >>
    >> the authleave just adds an * if needed. the pre contains either lcase(fname)
    >> or
    >> ucase(fname), based on another variable, so i get upper and lower case names
    >> to
    >> make the distinction.
    >>
    >> if i wanted to use text colors, how could i assign a text color instead of
    >> upper
    >> or lower case, when the variable is encountered ? if it's too difficult, just
    >> let me know and don't worry about it, this will suffice for my needs.
    >>
    >>
    >> With Workbooks(Curbook).Worksheets(Cursheet).Cells(Day(OfSetVal) + 3, m + 1)
    >> If .Value = "" Then
    >> .Value = Left(pre, Len(fname) - 4) & authLeave & " "
    >> ElseIf Right(.Value, 1) = " " Then
    >> .Value = Left(.Value, Len(.Value) - 1) & "-" & Left(pre, Len(fname) -
    >> _
    >> 4) & authLeave
    >> Else
    >> .Value = .Value & Chr(10) & Left(pre, Len(fname) - 4) & authLeave & "
    >> "
    >> End If
    >> End With
    >>
    >>
    >> Gary
    >>
    >>
    >>
    >>




+ 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