Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel formatting

Status
Not open for further replies.

netcashin

Programmer
Nov 13, 2000
159
US
Ok this is probably an easy question.

I am creating an excel file in VB and populating it. I wish to bold a row and change the width properties on a column. How can I do it?

Thanks

 
Hi!

Try using this code:

YourExcelObject.Rows("1:1").FontStyle = "Bold"
YourExcelObject.Columns("A:A").ColumnWidth = 20

Since the Rows and Columns properties need a string argument, you can build in a lot of flexibility if you want to.

hth Jeff Bridgham
bridgham@purdue.edu
 
try this too

Set myXLApp = createobject("Excel.Application")
myXLApp.Visible = True
Set myXL = myXLApp.Workbooks.Add
Set mySheet =myXL.WorkSheets(1)
Set myRng = mySheet.Range("A1")

rCount=0

With myRng.Offset(rCount,0)
.Font.Bold = True
.value="This is it"
End With
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top