Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default .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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default .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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default .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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default .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
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
.numberformat Q Aaron Excel Worksheet Functions 4 December 18th 09 02:15 AM
Numberformat applied but does not change data Tony Girgenti Excel Programming 11 January 23rd 08 05:55 PM
numberformat? Jack Sons Excel Discussion (Misc queries) 3 September 4th 07 03:44 PM
NumberFormat? alex Excel Worksheet Functions 3 March 1st 07 09:12 PM
Numberformat Syrus the Virus[_13_] Excel Programming 6 February 12th 04 02:12 PM


All times are GMT +1. The time now is 03:10 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"