Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Formatting Cells

Actually I think I got it with:

Cells(i, "H").NumberFormat = "0.00"
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
condionally formatting based on another cells formatting? Derrick Excel Discussion (Misc queries) 2 July 31st 09 08:05 PM
conditionally formatting cells based on other cells Derrick Excel Discussion (Misc queries) 1 July 7th 09 09:43 PM
Formatting cells in a column with conditional formatting? shamor Excel Discussion (Misc queries) 8 May 19th 08 10:11 PM
How can I have formatting options like merge cells ,Bold,active for the unlocked cells of the protected worksheet.Is it possible in excel? divya Excel Programming 2 July 20th 06 02:04 PM
Conditional Formatting Multiple cells based on 2 cells Louis Markowski Excel Worksheet Functions 2 June 1st 05 05:26 PM


All times are GMT +1. The time now is 09:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"