Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programming in VB
Hello all!
I have a problem I cannot get out of. I would like to ask you how to do in visual basic the following things: - change a border line - bold and the other possibilities - change the font size and font name, the text color This is easy question but I don`t know how to do it. Thank you in advance Marcin from Poland |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programming in VB
Sometimes, the easiest thing to do is to record a macro when you do it manually.
You'll get exactly the font size, name, and text color you want to use. Kamyk wrote: Hello all! I have a problem I cannot get out of. I would like to ask you how to do in visual basic the following things: - change a border line - bold and the other possibilities - change the font size and font name, the text color This is easy question but I don`t know how to do it. Thank you in advance Marcin from Poland -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Programming in VB
Kamyk,
Sub test() With Selection With .Font .Name = "Times New Roman" .Size = 20 End With .Interior.ColorIndex = 3 'red .Borders(xlEdgeTop).Weight = xlthin End With End Sub A good way to figure out things like this is to turn on the macro recorder and perform the actions you want to program, and then look at the resulting code. I did so and came up with this: Sub Macro1() ' ' Macro1 Macro ' Macro recorded 7/8/2004 by Doug Glancy ' Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone Selection.Borders(xlEdgeLeft).LineStyle = xlNone With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With Selection.Borders(xlEdgeBottom).LineStyle = xlNone Selection.Borders(xlEdgeRight).LineStyle = xlNone With Selection.Interior .ColorIndex = 3 .Pattern = xlSolid End With With Selection.Font .Name = "Arial" .Size = 10 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic End With With Selection.Font .Name = "Times New Roman" .Size = 10 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic End With With Selection.Font .Name = "Times New Roman" .Size = 20 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic End With End Sub There's a lot there that you don't need, but it's a good start. hth, Doug Glancy "Kamyk" wrote in message ... Hello all! I have a problem I cannot get out of. I would like to ask you how to do in visual basic the following things: - change a border line - bold and the other possibilities - change the font size and font name, the text color This is easy question but I don`t know how to do it. Thank you in advance Marcin from Poland |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Programming | Excel Discussion (Misc queries) | |||
programming | Excel Discussion (Misc queries) | |||
Programming help | Excel Discussion (Misc queries) | |||
Programming Help | Excel Programming | |||
Programming help | Excel Programming |