Number Format Code won't work

T

tbmarlie

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
 
G

Gary''s Student

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
 
T

tbmarlie

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 said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top