Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Format a cell
Looking to have a macro look through all data in a spreadsheet and format it based on criteria. If data is greater than 1 format as $ If data is less than 1 then format as a %. Thanks in advance!-Mike *** Sent via Developersdex http://www.developersdex.com *** |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Format a cell
This should give you the right idea: Sub test() Dim c As Range Dim ws As Worksheet Set ws = ActiveSheet For Each c In ws.Range("A1", ws.Cells.SpecialCells(xlCellTypeLastCell).Address) If c.Value < 1 Then c.NumberFormat = "0.00%" Else c.NumberFormat = "$#,##0.00" End If Next c End Sub "Michael Smith" wrote: Looking to have a macro look through all data in a spreadsheet and format it based on criteria. If data is greater than 1 format as $ If data is less than 1 then format as a %. Thanks in advance!-Mike *** Sent via Developersdex http://www.developersdex.com *** |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Format a cell
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Lock Cell Format - Allow copy and paste of data without format change | Excel Worksheet Functions | |||
cell format - remove cell format pattern without effecting colors | Excel Discussion (Misc queries) | |||
Can cell format come from and change with reference cell format | Excel Discussion (Misc queries) | |||
Excel Auto-Format cell to email format | Excel Discussion (Misc queries) | |||
How do I copy data in single cell format to a merged cell format | Excel Discussion (Misc queries) |