ShelleyBelly
New Member
- Joined
- Mar 2, 2011
- Messages
- 44
Hi All,
I've the below code but it doesn't seem to convert the 0 to show UTC
however the second to last line where the numbers are formatted works for all possitive and negatives but not for 0.
I've tried all sorts of combinations, many of which throw up a Type Mismatch.
I'll then be using .listindex to refer to the original TmZns array variable.
Any help would be greatly appreciated.
Many Thanks
Tom
I've the below code but it doesn't seem to convert the 0 to show UTC
however the second to last line where the numbers are formatted works for all possitive and negatives but not for 0.
Code:
Format(ComboBox1.List(i), "+h:mm;-h:mm; ""UTC"" ")
I've tried all sorts of combinations, many of which throw up a Type Mismatch.
I'll then be using .listindex to refer to the original TmZns array variable.
Code:
Private Sub UserForm_initialize()
Dim i As Integer
Dim TmZns As Variant
TmZns = Array(-1, 0, 1, 2, 3, 5)
For i = LBound(TmZns) To UBound(TmZns)
TmZns(i) = TmZns(i) / 24
Debug.Print TmZns(i)
Next i
' Populate the list with the date range
With ComboBox1
.List = TmZns
.ListIndex = 2
End With
'Format all items
For i = 0 To ComboBox1.ListCount - 1
ComboBox1.List(i) = Format(ComboBox1.List(i), "+h:mm;-h:mm; ""UTC"" ")
Next i
End Sub
Any help would be greatly appreciated.
Many Thanks
Tom