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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

excel cell formating 1

Status
Not open for further replies.

lchase

Instructor
Aug 8, 2002
42
US
I am filling excel from an access query. in the QBE there is a field called Weight it has 2 decimal places(all with zeros). I can't seem to format the cells containing this data (column J in Excel)I would like two decimal places but am getting 0. Here is what I've tried the 1,2 and 3 are just for reference
With xlSheet.Rows(lngRecordNumber)
.Cells(, hctr).Value = rstQuarterSales(hctr )'recordset
(1).Cells(, hctr) = Format( .Cells(, hctr) ,"###0.00")
(2).Cells(, hctr) = Format( .Cells(, hctr) ,"Fixed")
(3).Cells(, hctr) = Formatnumber( .Cells(, hctr), 2)
Any Help is appreciated.
Len
 
Len,

Try

Code:
.Cells(, hctr).NumberFormat = "###0.00"[code]

Format codes are the same as those used when you select Format/Cells... from the menu.


HTH
Mike
 
I tried that and it did the trick thanks.
Len
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top