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!

format column in exel spreadsheet 1

Status
Not open for further replies.

butchkmd

Programmer
Nov 13, 2001
83
0
0
US
I need to change the format of a column to "number" from "general" and have not been able to get it so far. Here is the code any suggestions?

sht.Range("d:d").ColumnWidth = 15
sht.Range("D3").Value = "CLAIM #"
sht.Range("D3").Font.Bold = True
sht.Range("D3").Font.Size = 11
sht.Range("D:D").FormatConditions.NumberFormat = "Number"

Thanks,
Matt
 
Hi Matt,

Try this...

Sub Format_Sheet()
sht = ActiveSheet.Name
Worksheets(sht).Range("d:d").ColumnWidth = 15
Worksheets(sht).Range("D3").Value = "CLAIM #"
Worksheets(sht).Range("D3").Font.Bold = True
Worksheets(sht).Range("D3").Font.Size = 11
Worksheets(sht).Columns("D:D").Select
Selection.NumberFormat = "0_);(0)"
End Sub

Hope it helps. :) Please advise as to how you make out.

Regards, ...Dale Watson dwatson@bsi.gov.mb.ca

 
the formatnumberline did the trick but the select line got an error. I made it read this and it worked...


Sub Format_Sheet()
sht = ActiveSheet.Name
Worksheets(sht).Range("d:d").ColumnWidth = 15
Worksheets(sht).Range("D3").Value = "CLAIM #"
Worksheets(sht).Range("D3").Font.Bold = True
Worksheets(sht).Range("D3").Font.Size = 11
Worksheets(sht).Columns("D:D").NumberFormat = "0_);(0)"
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top