View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student Gary''s Student is offline
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