Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 26
Default Number Format Code won't work

I have the following code to try to format two columns of numbers into
numeric format, but it doesn't want to work. There are blanks within
the 2 columns; otherwise I would just do a selec-end-down. Thanks.

Dim LastRow As Long
LastRow = Cells(Rows.Count, "G").End(xlUp).Row
Range("J2" & LastRow).NumberFormat = "#,##0.00_);[Red](#,##0.00)"
Range("K2" & LastRow).NumberFormat = "#,##0.00_);[Red](#,##0.00)"

Here's my sample data:

Column J Column K
Adjustment YTD Changes
6,550.63
6,550.63
1,984.62
1,984.62
-10,408.46
-10,408.46
13,350.04
13,350.04
4,118.37
4,118.37
-3,213.00
31.5
-6

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Number Format Code won't work

You have only a very small error:

Range("J2:J" & LastRow).NumberFormat = "#,##0.00_);[Red](#,##0.00)"
Range("K2:K" & LastRow).NumberFormat = "#,##0.00_);[Red](#,##0.00)"

this "fills out" the range. Make sure column G goes down far enough

--
Gary''s Student - gsnu2007


"tbmarlie" wrote:

I have the following code to try to format two columns of numbers into
numeric format, but it doesn't want to work. There are blanks within
the 2 columns; otherwise I would just do a selec-end-down. Thanks.

Dim LastRow As Long
LastRow = Cells(Rows.Count, "G").End(xlUp).Row
Range("J2" & LastRow).NumberFormat = "#,##0.00_);[Red](#,##0.00)"
Range("K2" & LastRow).NumberFormat = "#,##0.00_);[Red](#,##0.00)"

Here's my sample data:

Column J Column K
Adjustment YTD Changes
6,550.63
6,550.63
1,984.62
1,984.62
-10,408.46
-10,408.46
13,350.04
13,350.04
4,118.37
4,118.37
-3,213.00
31.5
-6


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 26
Default Number Format Code won't work

On Oct 12, 4:36 pm, Gary''s Student
wrote:
You have only a very small error:

Range("J2:J" & LastRow).NumberFormat = "#,##0.00_);[Red](#,##0.00)"
Range("K2:K" & LastRow).NumberFormat = "#,##0.00_);[Red](#,##0.00)"

this "fills out" the range. Make sure column G goes down far enough

--
Gary''s Student - gsnu2007



"tbmarlie" wrote:
I have the following code to try to format two columns of numbers into
numeric format, but it doesn't want to work. There are blanks within
the 2 columns; otherwise I would just do a selec-end-down. Thanks.


Dim LastRow As Long
LastRow = Cells(Rows.Count, "G").End(xlUp).Row
Range("J2" & LastRow).NumberFormat = "#,##0.00_);[Red](#,##0.00)"
Range("K2" & LastRow).NumberFormat = "#,##0.00_);[Red](#,##0.00)"


Here's my sample data:


Column J Column K
Adjustment YTD Changes
6,550.63
6,550.63
1,984.62
1,984.62
-10,408.46
-10,408.46
13,350.04
13,350.04
4,118.37
4,118.37
-3,213.00
31.5
-6- Hide quoted text -


- Show quoted text -


Thanks, Gary. That did the job.

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
Code Date Format Depending on Computer format Myriam Excel Discussion (Misc queries) 0 July 17th 07 03:26 PM
Convert a Number Code to a Text Code Traye Excel Discussion (Misc queries) 3 April 6th 07 09:54 PM
searching by number or code ina work book justsomeguy Excel Discussion (Misc queries) 0 February 19th 07 08:55 PM
code is not to work on sheet1 Allan R Jeffery New Users to Excel 3 August 22nd 06 02:22 PM
Format the Cell into a telephone number but using country code Chris Quinn Excel Discussion (Misc queries) 1 January 27th 05 03:51 PM


All times are GMT +1. The time now is 10:26 PM.

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"