ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   problem with cell reference and date (https://www.excelbanter.com/excel-programming/433175-problem-cell-reference-date.html)

NDBC

problem with cell reference and date
 
I am trying to pick up a time (date) out of cell u5. Can someone please tell
me why this

check1 = (Sheets("a grade").Range("u5"))

works and this

check2 = (Sheets("a grade").Cells(21, 5))

doesn't. Both check1 and check2 are dim as date and the value in u5 is
0.016018519

I'm not sure if it's relevant but the value in u5 is an elapsed time
generated by now()-start time. The start time is saved in a cell using a
button based on the now() command.

I have used check2=worksheetfunction.text(Sheets("a grade").Cells(21, 5)
"[hh]:mm:ss") but this doesn't work either.

Thanks for your help. It is driving me nuts.

NDBC

problem with cell reference and date
 
must be getting tired. Just tried cells(5, 21) and it worked a lot better.



"NDBC" wrote:

I am trying to pick up a time (date) out of cell u5. Can someone please tell
me why this

check1 = (Sheets("a grade").Range("u5"))

works and this

check2 = (Sheets("a grade").Cells(21, 5))

doesn't. Both check1 and check2 are dim as date and the value in u5 is
0.016018519

I'm not sure if it's relevant but the value in u5 is an elapsed time
generated by now()-start time. The start time is saved in a cell using a
button based on the now() command.

I have used check2=worksheetfunction.text(Sheets("a grade").Cells(21, 5)
"[hh]:mm:ss") but this doesn't work either.

Thanks for your help. It is driving me nuts.


Jacob Skaria

problem with cell reference and date
 
The first argument for CElls is Row...cells(row,column)

Range("u5")
is
Cells(5,21)

and not cells(21,5)

--
If this post helps click Yes
---------------
Jacob Skaria


"NDBC" wrote:

I am trying to pick up a time (date) out of cell u5. Can someone please tell
me why this

check1 = (Sheets("a grade").Range("u5"))

works and this

check2 = (Sheets("a grade").Cells(21, 5))

doesn't. Both check1 and check2 are dim as date and the value in u5 is
0.016018519

I'm not sure if it's relevant but the value in u5 is an elapsed time
generated by now()-start time. The start time is saved in a cell using a
button based on the now() command.

I have used check2=worksheetfunction.text(Sheets("a grade").Cells(21, 5)
"[hh]:mm:ss") but this doesn't work either.

Thanks for your help. It is driving me nuts.



All times are GMT +1. The time now is 03:05 AM.

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