J
Jay
Hello all,
I've trying to retrieve a cell value and pass it to a method, but the number
I'm expecting and the number I'm getting don't match.
The cell is a sum of a column of cells, but the format is [hh]:mm. The
columns being summed are hour and minute values. They continue counting if
the number goes above 24 (e.g., 89:54).
So I try to retrieve the cell value, but it displays as a decimal number,
representing the days. So 134:33 is retrieved as 5.55621 (actualy decimal
values are different, I'm just using dummy data for the example).
If I multiply that number by 24 to obtain the hours, I get the number of
hours, but I still get a decimal number. So 134:33 now equals 134.5314.
Now, I can live with the multiplication by 24. I just want to know WHY it
retrieves the value this way, and how I can force it to give me it in hours.
My end goal it to retrieve the value of the cell and only pass to a function
the number of hours.
So if I read 134:33, I send 134 (or round up to 135). Not have to do this
extra work.
To retrieve the values I've been using:
Sheets(shtName).Cells(row, column).Value
I tried Format(Sheets(shtName).Cells(row, column).Value, "h") but that
doesn't change the value. I also used "hh" and "[hh]" as the format with no
success.
So I'm hoping someone knows a way to accomplish what I'm trying (and
failing) to do. Any thoughts/suggestions are appreciated.
Cheers,
Jay
I've trying to retrieve a cell value and pass it to a method, but the number
I'm expecting and the number I'm getting don't match.
The cell is a sum of a column of cells, but the format is [hh]:mm. The
columns being summed are hour and minute values. They continue counting if
the number goes above 24 (e.g., 89:54).
So I try to retrieve the cell value, but it displays as a decimal number,
representing the days. So 134:33 is retrieved as 5.55621 (actualy decimal
values are different, I'm just using dummy data for the example).
If I multiply that number by 24 to obtain the hours, I get the number of
hours, but I still get a decimal number. So 134:33 now equals 134.5314.
Now, I can live with the multiplication by 24. I just want to know WHY it
retrieves the value this way, and how I can force it to give me it in hours.
My end goal it to retrieve the value of the cell and only pass to a function
the number of hours.
So if I read 134:33, I send 134 (or round up to 135). Not have to do this
extra work.
To retrieve the values I've been using:
Sheets(shtName).Cells(row, column).Value
I tried Format(Sheets(shtName).Cells(row, column).Value, "h") but that
doesn't change the value. I also used "hh" and "[hh]" as the format with no
success.
So I'm hoping someone knows a way to accomplish what I'm trying (and
failing) to do. Any thoughts/suggestions are appreciated.
Cheers,
Jay