PDA

View Full Version : Listview and hh:mm format



oleneazer
01-07-2006, 06:33 AM
Hello


Why in a listview showing a cell (with hh:mm format) I have 0,85752?

I don't understand why and how to have hh:mm format in a listwiew on a userform?


Thanks for your help.

Bob Phillips
01-07-2006, 06:43 AM
Hello


Why in a listview showing a cell (with hh:mm format) I have 0,85752?

I don't understand why and how to have hh:mm format in a listwiew on a userform?


Thanks for your help.

You need to format it when you laod the ListView

e.g. Format(Range("A1"),"hh:mm")

oleneazer
01-07-2006, 06:57 AM
Tahnk's for your answer
, but the problem is still there.


Here's the code
and I've still 0,xxxx in the listview

So i do this
the value o f the cell
= "'" & FormaDateTime(Time,4) but i wan't to know how to format the listview properly.

With ListView1
With .ColumnHeaders
.Clear
.Add , , "AAA", 60
.Add , , "BBB", 60
.Add , , "HEURE", 60
.Add , , "DDD", 80
End With

For Each Cell In Sheets(1).Range("A2:A11")
X = X + 1
.ListItems.Add , , Cell
.ListItems(X).ListSubItems.Add , , Cell.Offset(0, 1)
.ListItems(X).ListSubItems.Add , , Cell.Offset(0, 2)
.ListItems(X).ListSubItems.Add , , Format(Cell.Offset(0, 3), "hh:mm")
.ListItems(X).ListSubItems.Add , , Cell.Offset(0, 4)
Next

End With

oleneazer
01-07-2006, 07:28 AM
You can see in the attachment

that it doesn' work

Killian
01-09-2006, 03:57 AM
I think you've just confused which column to format.
According to your example, the time column is col 3. This will be the reference cell (column 1) offset by 2 columns.ListItems.Add , , Cell
.ListItems(X).ListSubItems.Add , , Cell.Offset(0, 1)
.ListItems(X).ListSubItems.Add , , Format(Cell.Offset(0, 2), "hh:mm")
.ListItems(X).ListSubItems.Add , , Cell.Offset(0, 3)