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

FormatNumber

Status
Not open for further replies.

adimulam

Programmer
Feb 13, 2002
25
0
0
US
Hi,
I am using Excel Spread sheet in my program. I want to format a numberic value in a paricular cell in such a way that the mumeric value has 2 digits after decimal (Ex 0.1 should come as 0.10). I tried "Wsheet.Cells(18, 18).FormatNumber = 2". It did not work. Any ideas?

Thanks,
Adimulam
 
Hi,
Now I am the newest of newbees and shouldn't even try to answer these questions, and I'm sure that I am missing the point but I couldn't resist...Apoligies in advance

Why don't you use the format button and select cells then the numbers tab and choose number and then select decimal places 2?

 
I need to control everything through VB. I do not want to physically open the document and format it.

Thaks,
Adimulam
 
I need to format the cell through VB program. I do not want to open the document physically and format the cell.

Thanks,
Srini
 
Code:
Wsheet.Cells(18, 18).NumberFormat = "0.00"

I'm assuming here that you have defined an object called
Code:
Wsheet
which refers to the worksheet you wish to format?
 
I found the answer myself. Wsheet.Cells(18, 18).Numberformat = "##0.00"

Thanks,
Adimulam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top