View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default Import Hours as Text

If brought next idea :
Hello,

I have this procedure that allows me to import another tab values €‹€‹in hours.
But I would like this data to be imported in text format.

---------------------------------------------------------------
Sub ImportCompensation()

Dim Nom As String, i As Long, j As Long
Sheets("Datas").Select
i = 3
With Sheets("Compensation")
Do While Cells(i, 1) < ""
Nom = Cells(i, 1)
For j = 1 To .Range("A65536").End(xlUp).Row
If Nom = .Cells(j, 3) Then
Cells(i, 14) = .Cells(j, 5)
Cells(i, 15) = .Cells(j, 6)
Cells(i, 16) = .Cells(j, 7)
Exit For
End If
Next
i = i + 1
Loop
End With

End Sub
------------------------------------------------------



I found this procedure to transform one hour in text format.
------------------------------------------------------
ActiveCell.Formula = "=TEXT(A1,""hh"""" h """"mm"")"
------------------------------------------------------
But the formula remains in the cell and I'd rather get my cell value.
I would like to get for example 10 hours 10 minutes in text format (not time
format)



It's possible to import formatted text with my first procedure?


Thanks for your answer.

Yves


Look in online help for the Format() function and how you might
implement it here. Also, you'll want to change the target cell's number
format to text. (NumberFormat = "@")

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc