![]() |
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 |
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 |
All times are GMT +1. The time now is 11:19 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com