ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how forrmating (https://www.excelbanter.com/excel-programming/337747-how-forrmating.html)

SunTEam

how forrmating
 
Hey guys,
I need some help. In Excel is possible to set a cell for number format,
data format .. and more
I need to check this format in macro. Do You know, how to do it?

now i'll try to explain what i do, maybe there is another solution for
my problems. So, i've got a worksheet and inside numbers. Some numbers
are the prices and the rest are dimension of products. I need to
calculate those prices for foreign exchange (dollars, euro ....) So i
need increase the price numbers. I set the price cells to number format
( cells formating ) and the dimension to char type. To finish my work i
need to recognize is the current selected cells of number formatting.
i tryied something like that:

IsNumeric(myCell.Value)

but if the cells is of char formatting and inside is number - the result
of isNumberic is "true". How can i split my numbers to numbers and text
.... and then recognize in VB script

Bob Phillips[_6_]

how forrmating
 
If myCell.NumberFormat = "#,##0.00"

or whatever your format is.

--

HTH

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


"SunTEam" wrote in message
...
Hey guys,
I need some help. In Excel is possible to set a cell for number format,
data format .. and more
I need to check this format in macro. Do You know, how to do it?

now i'll try to explain what i do, maybe there is another solution for
my problems. So, i've got a worksheet and inside numbers. Some numbers
are the prices and the rest are dimension of products. I need to
calculate those prices for foreign exchange (dollars, euro ....) So i
need increase the price numbers. I set the price cells to number format
( cells formating ) and the dimension to char type. To finish my work i
need to recognize is the current selected cells of number formatting.
i tryied something like that:

IsNumeric(myCell.Value)

but if the cells is of char formatting and inside is number - the result
of isNumberic is "true". How can i split my numbers to numbers and text
... and then recognize in VB script




SunTEam

how forrmating
 
Bob Phillips napisał(a):
If myCell.NumberFormat = "#,##0.00"

or whatever your format is.


Thank for help, but i cannot resolve my problem yet
Now i'im trying something like that

For Each myCells In mrange
If myCells.NumberFormat = "#,##0.00" Then
If myCells.Value < 0 Then
myCells.Value = myCells.Value * some
End If
End If
Next

... and no one number is changed :-(

dimension numbers are like : 80
prices number are like: 30.00

can you help me more?


SunTEam

how forrmating
 
SunTEam napisał(a):
Bob Phillips napisał(a):

If myCell.NumberFormat = "#,##0.00"


ok .now its' working
i changed "#,##0.00" to "0.00"

Bob Phillips[_6_]

how forrmating
 
I would also put an Isnumeric test in there, just in case.

--

HTH

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


"SunTEam" wrote in message
...
SunTEam napisał(a):
Bob Phillips napisał(a):

If myCell.NumberFormat = "#,##0.00"


ok .now its' working
i changed "#,##0.00" to "0.00"





All times are GMT +1. The time now is 10:15 AM.

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