PDA

View Full Version : [SOLVED] Time in userform listbox



gibbo1715
09-01-2005, 07:42 AM
If i have a row in a spreadsheet that is formatted hh:mm, how do i get my list box to display it in the same format?

something similar to below i guessing although the below doesnt work for me


For i = 3 To LastRow
If Cells(i, "G").value = "y" Then
oLB.AddItem Cells(i, "A")
oLB.List(oLB.ListCount - 1, 1) = Cells(i, "B")
oLB.List(oLB.ListCount - 1, 2) = Cells(i, "C")
oLB.List(oLB.ListCount - 1, 3) = Cells(i, "D")
oLB.List(oLB.ListCount - 1, Format(4, "hh:mm")) = Cells(i, "E")
oLB.List(oLB.ListCount - 1, 5) = Cells(i, "F")
oLB.List(oLB.ListCount - 1, 6) = i
End If

Norie
09-01-2005, 08:16 AM
Use the Text property to get the value in a cell as it is formatted.


oLB.List(oLB.ListCount - 1, 4, "hh:mm") = Cells(i, "E").Text

gibbo1715
09-01-2005, 11:13 AM
didnt work for me, just got a blank column

Norie
09-01-2005, 01:02 PM
How about this?


oLB.List(oLB.ListCount - 1, 4) = Cells(i, "E").Text

I'm assuming the time you want is in column E.

gibbo1715
09-01-2005, 01:05 PM
Norie, now that worked great

thanks again for your help

Cant believe how much im learning in here with the help of you all, it is very appreciated

Gibbo

Gibbo

Norie
09-01-2005, 01:11 PM
Gibbo

Glad it worked, I think it was just a typo in the code of my first post.

Don't know why I forgot to delete the "hh:mm". :oops: