Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm Initialization
Any ideas why the code below would not work. The referenced cell (1,13) will
either be blank, show 00:30 or 01:00. These values were placed in the cell with the following code: Dim lngValue 'As Long If OptionButton1.Value Then lngValue = "" If OptionButton2.Value Then lngValue = TimeSerial(0, 30, 0) If OptionButton3.Value Then lngValue = TimeSerial(0, 60, 0) rng(1, 13).Value = lngValue Private Sub UserForm_Initialize() Dim rng Set rng = Cells(ActiveCell.Row, 1) With ActiveCell.Offset(1, 13) If .Value = "" Then OptionButton1.Value = True ElseIf .Value = TimeSerial(0, 30, 0) Then OptionButton2.Value = True ElseIf .Value = TimeSerial(0, 60, 0) Then OptionButton3.Value = True End If End With End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForm Initialization
TimeSerial returns a double. Since your variable name is LngValue, I
expect it is dimmed as Long and is the source of your problem (it returns zero for either TimeSerial value). -- Regards, Tom Ogilvy "Patrick Simonds" wrote in message ... Any ideas why the code below would not work. The referenced cell (1,13) will either be blank, show 00:30 or 01:00. These values were placed in the cell with the following code: Dim lngValue 'As Long If OptionButton1.Value Then lngValue = "" If OptionButton2.Value Then lngValue = TimeSerial(0, 30, 0) If OptionButton3.Value Then lngValue = TimeSerial(0, 60, 0) rng(1, 13).Value = lngValue Private Sub UserForm_Initialize() Dim rng Set rng = Cells(ActiveCell.Row, 1) With ActiveCell.Offset(1, 13) If .Value = "" Then OptionButton1.Value = True ElseIf .Value = TimeSerial(0, 30, 0) Then OptionButton2.Value = True ElseIf .Value = TimeSerial(0, 60, 0) Then OptionButton3.Value = True End If End With End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Userform Initialization | Excel Programming | |||
ShowDataForm Initialization | Excel Programming | |||
User Form Initialization | Excel Programming | |||
List box initialization | Excel Programming | |||
List box initialization | Excel Programming |