ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Easy but not for me!! (https://www.excelbanter.com/excel-programming/323349-easy-but-not-me.html)

lynda

Easy but not for me!!
 
Hi I recieved a reply from Bob Phillips AND Tom Ogilvy
regarding a question I had on formatting of cells on my
sheet.

I would like to use the following code to specify that
the cells D6:D26 will always have the format of number
and 2 decimal places.

If ActiveCell.Numberformat = "0.00"
or
Activecell.Numberformat = "#,###.00"

Can you tell me how to use the above code and directly
link it to my cells D6:26

I know its simple but no matter how I try and specify the
range it doesnt work.

Thank you!

Lynda.

Trevor Shuttleworth

Easy but not for me!!
 
Lynda

Range("D2:D26").NumberFormat = "#,###.00"

Regards

Trevor


"Lynda" wrote in message
...
Hi I recieved a reply from Bob Phillips AND Tom Ogilvy
regarding a question I had on formatting of cells on my
sheet.

I would like to use the following code to specify that
the cells D6:D26 will always have the format of number
and 2 decimal places.

If ActiveCell.Numberformat = "0.00"
or
Activecell.Numberformat = "#,###.00"

Can you tell me how to use the above code and directly
link it to my cells D6:26

I know its simple but no matter how I try and specify the
range it doesnt work.

Thank you!

Lynda.




Bob Phillips[_6_]

Easy but not for me!!
 
Lynda,

I think you just want something like

Range("D2:D6").NumberFormat = "#,##0/00"

But be aware, if all cells are of that format it returns True, but if not,
it doesn't return False, it returns Null. But you can easily test with

If Range("D2:D6").NumberFormat = "#,##0/00" Then
... do your stuf
End If

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Lynda" wrote in message
...
Hi I recieved a reply from Bob Phillips AND Tom Ogilvy
regarding a question I had on formatting of cells on my
sheet.

I would like to use the following code to specify that
the cells D6:D26 will always have the format of number
and 2 decimal places.

If ActiveCell.Numberformat = "0.00"
or
Activecell.Numberformat = "#,###.00"

Can you tell me how to use the above code and directly
link it to my cells D6:26

I know its simple but no matter how I try and specify the
range it doesnt work.

Thank you!

Lynda.




lynda

Thank You
 

Thats Great!


-----Original Message-----
Hi I recieved a reply from Bob Phillips AND Tom Ogilvy
regarding a question I had on formatting of cells on my
sheet.

I would like to use the following code to specify that
the cells D6:D26 will always have the format of number
and 2 decimal places.

If ActiveCell.Numberformat = "0.00"
or
Activecell.Numberformat = "#,###.00"

Can you tell me how to use the above code and directly
link it to my cells D6:26

I know its simple but no matter how I try and specify

the
range it doesnt work.

Thank you!

Lynda.
.



All times are GMT +1. The time now is 09:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com