Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming dim Excel Discussion (Misc queries) 7 November 16th 07 11:56 AM
programming ernie Excel Discussion (Misc queries) 4 March 13th 06 02:06 PM
Programming help BB Excel Discussion (Misc queries) 3 December 5th 05 01:09 AM
Programming Help Nate[_5_] Excel Programming 6 May 21st 04 08:08 PM
Programming help Me Excel Programming 13 December 26th 03 08:18 PM


All times are GMT +1. The time now is 08:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"