Number to Time

  • Thread starter Thread starter hyyfte
  • Start date Start date
H

hyyfte

Here's what I have:


Code
-------------------
tih = Selection
ActiveCell.Offset(0, 1).Select
tih2 = Selection
ActiveCell.Offset(0, 2).Select
tim = Selection
ActiveCell.Offset(0, 1).Select
tim2 = Selection
TimeIn = tih & tih2 & tim & tim
-------------------



TimeIn = "0745"

How do I make the expression TimeIn have a value of 7:45 instead o
745
 
Try:


Code
-------------------
tih = Selection
ActiveCell.Offset(0, 1).Select
tih2 = Selection
ActiveCell.Offset(0, 2).Select
tim = Selection
ActiveCell.Offset(0, 1).Select
tim2 = Selection
TimeIn = TimeSerial(tih & tih2, tim & tim2, 0
 
With Selection
TimeIn = TimeSerial(.value& .Offset(0,1).value, .Offset(0,3).value&
..Offset(0,4).value, 0)
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top