LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 671
Default Error in Retrieving Formatted Cell Value

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
--
Disregard, this is so I can find my post later.
***postedbyJay***
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stop error checking a cell that has been formatted to text Tammy Excel Discussion (Misc queries) 3 July 10th 08 02:27 PM
Retrieving Data: Speed of beating down rows vs retrieving from array? (PeteCresswell) Excel Programming 2 July 9th 07 03:30 PM
Error in Retrieving Worksheet.OLEObjects property Sarang Excel Programming 0 March 28th 07 02:17 AM
Converting 'General' formatted cells to Text formatted cell using. Zahid Khan Excel Worksheet Functions 1 March 12th 05 07:13 PM
Error retrieving value of the specified Excel cell (Not active) Jack Excel Programming 2 February 13th 04 03:50 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"