Combo Box Time Zone Format Values

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.

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
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,215,482
Messages
6,125,061
Members
449,206
Latest member
Healthydogs

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top