Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Illinois
    Posts
    552
    Thanks
    0
    Thanked 1 Time in 1 Post

    excel macro to bold or italicize (W2000, office xp)

    I need to check a column of numbers to find out if a lower or upper case letter exists in each cell. IF a lower case letter is in the cell i need the cell to the left of it made italic, if the cell is upper case i need the cell to the left of it made bold. I tried all kinds of for/next and used LCase and UCase but can't get it right. Can you please get me started on the right track. Thank you

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: excel macro to bold or italicize (W2000, office xp)

    Can you be a little more specific about what you are trying to check for. Does the cell you are checking contain more than one letter, and if so which one are you checking or are you checking to see if any of them are uppercase? Is it one specific upper case letter that you are checking for, like an upper case A, or any upper case letter? What cell or cells are you checking?

    The following can be used to check if cell A1 is all upper case:

    <pre> If Range("A1").Value = UCase(Range("A1").Value) Then
    MsgBox "A1 is Upper Case"
    Else
    MsgBox "A1 is NOT Upper Case"
    End If
    </pre>

    Legare Coleman

  3. #3
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Illinois
    Posts
    552
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: excel macro to bold or italicize (W2000, office xp)

    I am checking the range b1:b500, d1:d500, f1:f500... all the way through column z (every other column). Each of the cells in these columns may or may not have a letter in it (just 1 letter). If the letter is lowercase i need the number to the right of it to be italic. ie: b3 has an "h" in it. I need a3's value to be italicized. If b7 has an "H" i need a7's value to be bolded. THank you so much for the help.

  4. #4
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: excel macro to bold or italicize (W2000, office xp)

    Something like this should do what you want:

    <pre>Public Sub CapOrItal()
    Dim I As Integer, J As Integer
    For I = 0 To 499
    For J = 0 To 26 Step 2
    With Worksheets("Sheet1").Range("A1")
    If .Offset(I, J + 1).Value = "" Then
    .Offset(I, J).Font.Bold = False
    .Offset(I, J).Font.Italic = False
    Else
    If .Offset(I, J + 1).Value = UCase(.Offset(I, J + 1).Value) Then
    .Offset(I, J).Font.Bold = True
    .Offset(I, J).Font.Italic = False
    Else
    .Offset(I, J).Font.Bold = False
    .Offset(I, J).Font.Italic = True
    End If
    End If
    End With
    Next J
    Next I
    End Sub
    </pre>

    Legare Coleman

Posting Permissions

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