Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Userform Initialization Patrick Simonds Excel Programming 2 May 22nd 04 10:17 PM
ShowDataForm Initialization Alan Excel Programming 2 February 11th 04 11:24 PM
User Form Initialization Josh[_7_] Excel Programming 1 November 5th 03 07:35 PM
List box initialization Tom Ogilvy Excel Programming 0 July 15th 03 05:41 PM
List box initialization Daniel Thompson Excel Programming 0 July 15th 03 05:17 PM


All times are GMT +1. The time now is 09:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"