Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Formatting Cells
I'm running through a list of cells with dollar values. Some are even dollars
some are not. (ie. 10, 10.45, etc.) I don't want to worry about adding a dollar sign, and there's no negative values. I would like to format the cells though so that there's 2 decimal places no matter what. How would I best go about doing this? Here's the loop I'm running: Dim lastRow As Long 'Used to hold the value of last row on the sheet. Dim i As Integer 'Used to incriment For Loop. lastRow = Cells(Rows.Count, "H").End(xlUp).Row 'Get the last row on the page. For i = 2 To lastRow 'Start at 2 to ignore heard line. If Cells(i, "H").Value < "" And Cells(i, "H").Value < 0 Then Cells(i, "H").Value = Cells(i, "H").Value / Cells(i, "G").Value End If Next i 'Incriment counter and reloop While I'm at it, does anyone know of a link, or perhaps able to suggest a book for me to look at, that lists all the various properties, etc. for objects in VBA (such as Cells, Rows, Range, etc.) Sometimes options come up and sometimes they don't in the editor. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Formatting Cells
Actually I think I got it with:
Cells(i, "H").NumberFormat = "0.00" |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
condionally formatting based on another cells formatting? | Excel Discussion (Misc queries) | |||
conditionally formatting cells based on other cells | Excel Discussion (Misc queries) | |||
Formatting cells in a column with conditional formatting? | Excel Discussion (Misc queries) | |||
How can I have formatting options like merge cells ,Bold,active for the unlocked cells of the protected worksheet.Is it possible in excel? | Excel Programming | |||
Conditional Formatting Multiple cells based on 2 cells | Excel Worksheet Functions |