Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
.NumberFormat not getting applied?
---------------------------------------------------------------------------------
Const mFormat_DollarAmount As String = "#,##0.00" 4140 With .Columns(mColNum_FP_AmountOutstanding) 4141 .ColumnWidth = 15 4142 .NumberFormat = mFormat_DollarAmount 4143 .HorizontalAlignment = xlRight 4149 End With --------------------------------------------------------------------------------- The width and horizontal alignments are working, but the .NumberFormat is not. Same problem with date columns: --------------------------------------------- Const mFormat_Date="mm/dd/yyyy" ..NumberFormat = mFormat_Date -------------------------------------------- Some limitation on what I can do at the column level? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
.NumberFormat not getting applied?
Can't duplicate the problem. Code works fine for me.
"PeteCresswell" wrote: --------------------------------------------------------------------------------- Const mFormat_DollarAmount As String = "#,##0.00" 4140 With .Columns(mColNum_FP_AmountOutstanding) 4141 .ColumnWidth = 15 4142 .NumberFormat = mFormat_DollarAmount 4143 .HorizontalAlignment = xlRight 4149 End With --------------------------------------------------------------------------------- The width and horizontal alignments are working, but the .NumberFormat is not. Same problem with date columns: --------------------------------------------- Const mFormat_Date="mm/dd/yyyy" ..NumberFormat = mFormat_Date -------------------------------------------- Some limitation on what I can do at the column level? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
.NumberFormat not getting applied?
Any chance that you're looking at the wrong column??? You didn't show what that
..columns(...) referred to. And two wild guesses... Do you have merged cells in that range? What's the style for that range? Is it something special or is it Normal? Does the code work on a brand new worksheet? PeteCresswell wrote: --------------------------------------------------------------------------------- Const mFormat_DollarAmount As String = "#,##0.00" 4140 With .Columns(mColNum_FP_AmountOutstanding) 4141 .ColumnWidth = 15 4142 .NumberFormat = mFormat_DollarAmount 4143 .HorizontalAlignment = xlRight 4149 End With --------------------------------------------------------------------------------- The width and horizontal alignments are working, but the .NumberFormat is not. Same problem with date columns: --------------------------------------------- Const mFormat_Date="mm/dd/yyyy" .NumberFormat = mFormat_Date -------------------------------------------- Some limitation on what I can do at the column level? -- Dave Peterson |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
.NumberFormat not getting applied?
On Sat, 17 May 2008 08:51:34 -0700 (PDT), PeteCresswell
wrote: --------------------------------------------------------------------------------- Const mFormat_DollarAmount As String = "#,##0.00" 4140 With .Columns(mColNum_FP_AmountOutstanding) 4141 .ColumnWidth = 15 4142 .NumberFormat = mFormat_DollarAmount 4143 .HorizontalAlignment = xlRight 4149 End With --------------------------------------------------------------------------------- The width and horizontal alignments are working, but the .NumberFormat is not. Same problem with date columns: --------------------------------------------- Const mFormat_Date="mm/dd/yyyy" .NumberFormat = mFormat_Date -------------------------------------------- Some limitation on what I can do at the column level? You don't post much of your code, so it's hard to know where the problem is. Some of the possibilities include an improper declaration of the columns property; use of this code snippet with a function (it would need to be in a sub). Here is a short routine demonstrating several different ways of setting formats for an entire column, none of which match what you have written: ============================= Option Explicit Sub colfmt() Dim c As Range Set c = Range("a1") c.EntireColumn.NumberFormat = "mm/dd/yyyy" Columns(2).NumberFormat = "mm/dd/yy" With Columns(3) .NumberFormat = "mm/dd/yy" .ColumnWidth = 25 .HorizontalAlignment = xlCenter End With End Sub ================================== --ron |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
.numberformat Q | Excel Worksheet Functions | |||
Numberformat applied but does not change data | Excel Programming | |||
numberformat? | Excel Discussion (Misc queries) | |||
NumberFormat? | Excel Worksheet Functions | |||
Numberformat | Excel Programming |