Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Formatting Text to Italic AND Underlined to individually listed cells
I am trying to set the below listed cells to have the values displayed in
Italic AND Underlined. Nothing seems to happen with the below??? ActiveSheet.Select Dim rng As Range Set rng = Range("A1,B1,D1,F1,B2,E2,B3,C3,D3,E3,F3,G3,H3,I3") With rng Font.Italic = False Font.Underline = True Range("A1").Value = "Roll#" Range("B1").Value = "Customer" Range("D1").Value = "Date" Range("F1").Value = "Belt Type" Range("B2").Value = "ST Job No." Range("E2").Value = "Inspectors Names" Range("B3").Value = "Item No." Range("C3").Value = "Section Length" Range("D3").Value = "Width" Range("E3").Value = "Belt Type" Range("F3").Value = "Top Cover" Range("G3").Value = "Bottom Cover" Range("H3").Value = "Event Type" Range("I3").Value = "Comments/Stamp Id's" End With Did i miss something? Corey.... |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Formatting Text to Italic AND Underlined to individually listedcells
If you want Italic, I would think that True would work better than False.
And watch your with/end with statements. I bet you want something more like: Option Explicit Sub testme() Dim rng As Range Set rng = Range("A1,B1,D1,F1,B2,E2,B3,C3,D3,E3,F3,G3,H3,I3") With rng .Font.Italic = True .Font.Underline = True End With Range("A1").Value = "Roll#" Range("B1").Value = "Customer" Range("D1").Value = "Date" Range("F1").Value = "Belt Type" Range("B2").Value = "ST Job No." Range("E2").Value = "Inspectors Names" Range("B3").Value = "Item No." Range("C3").Value = "Section Length" Range("D3").Value = "Width" Range("E3").Value = "Belt Type" Range("F3").Value = "Top Cover" Range("G3").Value = "Bottom Cover" Range("H3").Value = "Event Type" Range("I3").Value = "Comments/Stamp Id's" End Sub Corey wrote: I am trying to set the below listed cells to have the values displayed in Italic AND Underlined. Nothing seems to happen with the below??? ActiveSheet.Select Dim rng As Range Set rng = Range("A1,B1,D1,F1,B2,E2,B3,C3,D3,E3,F3,G3,H3,I3") With rng Font.Italic = False Font.Underline = True Range("A1").Value = "Roll#" Range("B1").Value = "Customer" Range("D1").Value = "Date" Range("F1").Value = "Belt Type" Range("B2").Value = "ST Job No." Range("E2").Value = "Inspectors Names" Range("B3").Value = "Item No." Range("C3").Value = "Section Length" Range("D3").Value = "Width" Range("E3").Value = "Belt Type" Range("F3").Value = "Top Cover" Range("G3").Value = "Bottom Cover" Range("H3").Value = "Event Type" Range("I3").Value = "Comments/Stamp Id's" End With Did i miss something? Corey.... -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Formatting Text to Italic AND Underlined to individually listed cells
Thanks Dave.
I did have the Italic set to TRUE but i changed it back to FALSE to see if i accedently had the entire sheet in italic. "Dave Peterson" wrote in message ... If you want Italic, I would think that True would work better than False. And watch your with/end with statements. I bet you want something more like: Option Explicit Sub testme() Dim rng As Range Set rng = Range("A1,B1,D1,F1,B2,E2,B3,C3,D3,E3,F3,G3,H3,I3") With rng .Font.Italic = True .Font.Underline = True End With Range("A1").Value = "Roll#" Range("B1").Value = "Customer" Range("D1").Value = "Date" Range("F1").Value = "Belt Type" Range("B2").Value = "ST Job No." Range("E2").Value = "Inspectors Names" Range("B3").Value = "Item No." Range("C3").Value = "Section Length" Range("D3").Value = "Width" Range("E3").Value = "Belt Type" Range("F3").Value = "Top Cover" Range("G3").Value = "Bottom Cover" Range("H3").Value = "Event Type" Range("I3").Value = "Comments/Stamp Id's" End Sub Corey wrote: I am trying to set the below listed cells to have the values displayed in Italic AND Underlined. Nothing seems to happen with the below??? ActiveSheet.Select Dim rng As Range Set rng = Range("A1,B1,D1,F1,B2,E2,B3,C3,D3,E3,F3,G3,H3,I3") With rng Font.Italic = False Font.Underline = True Range("A1").Value = "Roll#" Range("B1").Value = "Customer" Range("D1").Value = "Date" Range("F1").Value = "Belt Type" Range("B2").Value = "ST Job No." Range("E2").Value = "Inspectors Names" Range("B3").Value = "Item No." Range("C3").Value = "Section Length" Range("D3").Value = "Width" Range("E3").Value = "Belt Type" Range("F3").Value = "Top Cover" Range("G3").Value = "Bottom Cover" Range("H3").Value = "Event Type" Range("I3").Value = "Comments/Stamp Id's" End With Did i miss something? Corey.... -- Dave Peterson |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Formatting Text to Italic AND Underlined to individually listedcells
My bet is that you underlined/italicized different cells than you meant.
If you do this: dim myRng as range set myrng = range("b3") 'then use with myrng .range("b2").font.italic = true 'and more end with You're not formatting B2 of that worksheet, you're formatting the cell that corresponds to the cell in myRng (B3 in my sample). And activesheet.range("b3").range("B2") is the same as C4--it's one cell to the right and one cell down. That's why I moved the "End with" to its new location in the code. Corey wrote: Thanks Dave. I did have the Italic set to TRUE but i changed it back to FALSE to see if i accedently had the entire sheet in italic. "Dave Peterson" wrote in message ... If you want Italic, I would think that True would work better than False. And watch your with/end with statements. I bet you want something more like: Option Explicit Sub testme() Dim rng As Range Set rng = Range("A1,B1,D1,F1,B2,E2,B3,C3,D3,E3,F3,G3,H3,I3") With rng .Font.Italic = True .Font.Underline = True End With Range("A1").Value = "Roll#" Range("B1").Value = "Customer" Range("D1").Value = "Date" Range("F1").Value = "Belt Type" Range("B2").Value = "ST Job No." Range("E2").Value = "Inspectors Names" Range("B3").Value = "Item No." Range("C3").Value = "Section Length" Range("D3").Value = "Width" Range("E3").Value = "Belt Type" Range("F3").Value = "Top Cover" Range("G3").Value = "Bottom Cover" Range("H3").Value = "Event Type" Range("I3").Value = "Comments/Stamp Id's" End Sub Corey wrote: I am trying to set the below listed cells to have the values displayed in Italic AND Underlined. Nothing seems to happen with the below??? ActiveSheet.Select Dim rng As Range Set rng = Range("A1,B1,D1,F1,B2,E2,B3,C3,D3,E3,F3,G3,H3,I3") With rng Font.Italic = False Font.Underline = True Range("A1").Value = "Roll#" Range("B1").Value = "Customer" Range("D1").Value = "Date" Range("F1").Value = "Belt Type" Range("B2").Value = "ST Job No." Range("E2").Value = "Inspectors Names" Range("B3").Value = "Item No." Range("C3").Value = "Section Length" Range("D3").Value = "Width" Range("E3").Value = "Belt Type" Range("F3").Value = "Top Cover" Range("G3").Value = "Bottom Cover" Range("H3").Value = "Event Type" Range("I3").Value = "Comments/Stamp Id's" End With Did i miss something? Corey.... -- Dave Peterson -- Dave Peterson |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Formatting Text to Italic AND Underlined to individually listedcells
This may be better:
You're not formatting B2 of that worksheet, you're formatting the cell that corresponds to B2 if you assume the origin is myRng (B3 in my sample). Instead of this: You're not formatting B2 of that worksheet, you're formatting the cell that corresponds to the cell in myRng (B3 in my sample). Dave Peterson wrote: My bet is that you underlined/italicized different cells than you meant. If you do this: dim myRng as range set myrng = range("b3") 'then use with myrng .range("b2").font.italic = true 'and more end with You're not formatting B2 of that worksheet, you're formatting the cell that corresponds to the cell in myRng (B3 in my sample). And activesheet.range("b3").range("B2") is the same as C4--it's one cell to the right and one cell down. That's why I moved the "End with" to its new location in the code. Corey wrote: Thanks Dave. I did have the Italic set to TRUE but i changed it back to FALSE to see if i accedently had the entire sheet in italic. "Dave Peterson" wrote in message ... If you want Italic, I would think that True would work better than False. And watch your with/end with statements. I bet you want something more like: Option Explicit Sub testme() Dim rng As Range Set rng = Range("A1,B1,D1,F1,B2,E2,B3,C3,D3,E3,F3,G3,H3,I3") With rng .Font.Italic = True .Font.Underline = True End With Range("A1").Value = "Roll#" Range("B1").Value = "Customer" Range("D1").Value = "Date" Range("F1").Value = "Belt Type" Range("B2").Value = "ST Job No." Range("E2").Value = "Inspectors Names" Range("B3").Value = "Item No." Range("C3").Value = "Section Length" Range("D3").Value = "Width" Range("E3").Value = "Belt Type" Range("F3").Value = "Top Cover" Range("G3").Value = "Bottom Cover" Range("H3").Value = "Event Type" Range("I3").Value = "Comments/Stamp Id's" End Sub Corey wrote: I am trying to set the below listed cells to have the values displayed in Italic AND Underlined. Nothing seems to happen with the below??? ActiveSheet.Select Dim rng As Range Set rng = Range("A1,B1,D1,F1,B2,E2,B3,C3,D3,E3,F3,G3,H3,I3") With rng Font.Italic = False Font.Underline = True Range("A1").Value = "Roll#" Range("B1").Value = "Customer" Range("D1").Value = "Date" Range("F1").Value = "Belt Type" Range("B2").Value = "ST Job No." Range("E2").Value = "Inspectors Names" Range("B3").Value = "Item No." Range("C3").Value = "Section Length" Range("D3").Value = "Width" Range("E3").Value = "Belt Type" Range("F3").Value = "Top Cover" Range("G3").Value = "Bottom Cover" Range("H3").Value = "Event Type" Range("I3").Value = "Comments/Stamp Id's" End With Did i miss something? Corey.... -- Dave Peterson -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Cannot save text wrapping in cells-must do individually | Excel Discussion (Misc queries) | |||
Counting cells with text not listed. | Excel Worksheet Functions | |||
Lookup and change to italic italic | Excel Worksheet Functions | |||
How to count the number of Excel cells with text formatted Italic | Excel Worksheet Functions | |||
How can I detect if the text in a cell is underlined? | Excel Programming |