ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Decimal Dilemma (https://www.excelbanter.com/excel-programming/382142-decimal-dilemma.html)

Arturo

Decimal Dilemma
 
Im looping through a column of numbers. Each number is stored in a
variable, Y_CellTest, as that row is dealt with and a comparative test is
performed. The value of Y_CellTest can go out a varying number of positions
to the right of the decimal point. How do I alter that variable Y_CellTest,
to read only X numbers of places to the right of the decimal point?
Currently the line reads Y_CellTest = Worksheets(2).Cells(Loop_rO,
coLArray(X_col)). Y_CellTest = 43.3762286964325 but I want it to read only
say 4 places to the right of the decimal point, Y_CellTest = 43.3762.

Appreciatively,
Arturo

Arturo

Decimal Dilemma
 
Got it:

Y_CellTest = Round(Worksheets(2).Cells(Loop_rO, coLArray(X_col)), 4)

"Arturo" wrote:

Im looping through a column of numbers. Each number is stored in a
variable, Y_CellTest, as that row is dealt with and a comparative test is
performed. The value of Y_CellTest can go out a varying number of positions
to the right of the decimal point. How do I alter that variable Y_CellTest,
to read only X numbers of places to the right of the decimal point?
Currently the line reads Y_CellTest = Worksheets(2).Cells(Loop_rO,
coLArray(X_col)). Y_CellTest = 43.3762286964325 but I want it to read only
say 4 places to the right of the decimal point, Y_CellTest = 43.3762.

Appreciatively,
Arturo



All times are GMT +1. The time now is 07:08 AM.

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