Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Form Initialized


I have created a range of option buttons on my user form and have
grouped them in thecode as advised in the help files on VB. This works
fine however when i click between the option buttons the activie one
deactivates and i then have to click again to get the new selection to
hghlight.

Id rather it switched with one click rather than two, can this be
done?and what am i doing wrong?


Here's my code i run when the form is initalised

OptionButton5.GroupName = "Weeks"
OptionButton6.GroupName = "Weeks"
OptionButton7.GroupName = "Weeks"
OptionButton8.GroupName = "Weeks"
OptionButton9.GroupName = "Weeks"


--
ceemo
------------------------------------------------------------------------
ceemo's Profile: http://www.excelforum.com/member.php...o&userid=10650
View this thread: http://www.excelforum.com/showthread...hreadid=399737

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Form Initialized

ceemo,

That works for me - one click selects the new button (XL 03). Maybe you
should show us more code.

Doug

"ceemo" wrote in
message ...

I have created a range of option buttons on my user form and have
grouped them in thecode as advised in the help files on VB. This works
fine however when i click between the option buttons the activie one
deactivates and i then have to click again to get the new selection to
hghlight.

Id rather it switched with one click rather than two, can this be
done?and what am i doing wrong?


Here's my code i run when the form is initalised

OptionButton5.GroupName = "Weeks"
OptionButton6.GroupName = "Weeks"
OptionButton7.GroupName = "Weeks"
OptionButton8.GroupName = "Weeks"
OptionButton9.GroupName = "Weeks"


--
ceemo
------------------------------------------------------------------------
ceemo's Profile:
http://www.excelforum.com/member.php...o&userid=10650
View this thread: http://www.excelforum.com/showthread...hreadid=399737



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Form Initialized


Hi here's the full code

Private Sub UserForm_Initialize()

Sheets("info").Activate

Let myweek = Range("K25")
Let Range("AE2") = False
Let Range("AF2") = False
Let Range("AG2") = False
Let Range("AH2") = False
Let Range("AI2") = False
Let Range("AJ2") = False
Let Range("AK2") = False
Let Range("AL2") = False
Let Range("I27") = True


ComboBox1.ListRows = Range("AB53")

If myweek = 1 Then GoTo week1:
If myweek = 2 Then GoTo week2:
If myweek = 3 Then GoTo week3:
If myweek = 4 Then GoTo week4:
GoTo join:



week1:
OptionButton6.Enabled = False
OptionButton7.Enabled = False
OptionButton8.Enabled = False
OptionButton9.Enabled = False
GoTo join:

week2:
OptionButton7.Enabled = False
OptionButton8.Enabled = False
OptionButton9.Enabled = False
GoTo join:


week3:
OptionButton8.Enabled = False
OptionButton9.Enabled = False
GoTo join:

week4:
OptionButton9.Enabled = False
GoTo join:


join:
'Weekcommencing
OptionButton5.GroupName = "Weeks"
OptionButton6.GroupName = "Weeks"
OptionButton7.GroupName = "Weeks"
OptionButton8.GroupName = "Weeks"
OptionButton9.GroupName = "Weeks"
'OptionButton6.Value = False


'Combo box1
Let mycombo1 = Range("AB54").Value
ComboBox1.RowSource = mycombo1

'Combo box 2
mycombo2 = Range("U19")
ComboBox2.ColumnCount = 5
ComboBox2.RowSource = mycombo2
ComboBox2.ControlSource = "R2"
ComboBox2.BoundColumn = 1

'Telephony Skills
OptionButton1.GroupName = "Widgets"
OptionButton2.GroupName = "Widgets"
OptionButton3.GroupName = "Widgets"
OptionButton4.GroupName = "Widgets"


End Sub


--
ceemo
------------------------------------------------------------------------
ceemo's Profile: http://www.excelforum.com/member.php...o&userid=10650
View this thread: http://www.excelforum.com/showthread...hreadid=399737

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Form Initialized

ceemo,

Do you know for a fact that Join is executed? Have you stepped the code
with the debugger?

Gotos are generally discouraged as they can make it hard to trace the
execution of your code. Here's an alternative module. I commented out the
myCombo/ComboBox section as I didn't understand it, but the option buttons
behave as they should:

Private Sub UserForm_Initialize()

Dim myweek As Long

With Sheets("info")
myweek = .Range("K25")
.Range("AE2:al2") = False
.Range("I27") = True
End With

ComboBox1.ListRows = Range("AB53")

If myweek = 1 Then
OptionButton6.Enabled = False
OptionButton7.Enabled = False
OptionButton8.Enabled = False
OptionButton9.Enabled = False
ElseIf myweek = 2 Then
OptionButton7.Enabled = False
OptionButton8.Enabled = False
OptionButton9.Enabled = False
ElseIf myweek = 3 Then
OptionButton8.Enabled = False
OptionButton9.Enabled = False
ElseIf myweek = 4 Then
OptionButton9.Enabled = False
End If

'Weekcommencing
OptionButton5.GroupName = "Weeks"
OptionButton6.GroupName = "Weeks"
OptionButton7.GroupName = "Weeks"
OptionButton8.GroupName = "Weeks"
OptionButton9.GroupName = "Weeks"
'OptionButton6.Value = False

''Combo box1
'mycombo1 = Range("AB54").Value
'ComboBox1.RowSource = mycombo1
'
''Combo box 2
'mycombo2 = Range("U19")
'ComboBox2.ColumnCount = 5
'ComboBox2.RowSource = mycombo2
'ComboBox2.ControlSource = "R2"
'ComboBox2.BoundColumn = 1

'Telephony Skills
OptionButton1.GroupName = "Widgets"
OptionButton2.GroupName = "Widgets"
OptionButton3.GroupName = "Widgets"
OptionButton4.GroupName = "Widgets"
End Sub

--
hth,

Doug
"ceemo" wrote in
message ...

Hi here's the full code

Private Sub UserForm_Initialize()

Sheets("info").Activate

Let myweek = Range("K25")
Let Range("AE2") = False
Let Range("AF2") = False
Let Range("AG2") = False
Let Range("AH2") = False
Let Range("AI2") = False
Let Range("AJ2") = False
Let Range("AK2") = False
Let Range("AL2") = False
Let Range("I27") = True


ComboBox1.ListRows = Range("AB53")

If myweek = 1 Then GoTo week1:
If myweek = 2 Then GoTo week2:
If myweek = 3 Then GoTo week3:
If myweek = 4 Then GoTo week4:
GoTo join:



week1:
OptionButton6.Enabled = False
OptionButton7.Enabled = False
OptionButton8.Enabled = False
OptionButton9.Enabled = False
GoTo join:

week2:
OptionButton7.Enabled = False
OptionButton8.Enabled = False
OptionButton9.Enabled = False
GoTo join:


week3:
OptionButton8.Enabled = False
OptionButton9.Enabled = False
GoTo join:

week4:
OptionButton9.Enabled = False
GoTo join:


join:
'Weekcommencing
OptionButton5.GroupName = "Weeks"
OptionButton6.GroupName = "Weeks"
OptionButton7.GroupName = "Weeks"
OptionButton8.GroupName = "Weeks"
OptionButton9.GroupName = "Weeks"
'OptionButton6.Value = False


'Combo box1
Let mycombo1 = Range("AB54").Value
ComboBox1.RowSource = mycombo1

'Combo box 2
mycombo2 = Range("U19")
ComboBox2.ColumnCount = 5
ComboBox2.RowSource = mycombo2
ComboBox2.ControlSource = "R2"
ComboBox2.BoundColumn = 1

'Telephony Skills
OptionButton1.GroupName = "Widgets"
OptionButton2.GroupName = "Widgets"
OptionButton3.GroupName = "Widgets"
OptionButton4.GroupName = "Widgets"


End Sub


--
ceemo
------------------------------------------------------------------------
ceemo's Profile:
http://www.excelforum.com/member.php...o&userid=10650
View this thread: http://www.excelforum.com/showthread...hreadid=399737



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Form Initialized


Well i deleted the buttons and set them back up as they were and no
they work so they must have become corrupt. Thanks for coding tips

--
ceem
-----------------------------------------------------------------------
ceemo's Profile: http://www.excelforum.com/member.php...fo&userid=1065
View this thread: http://www.excelforum.com/showthread.php?threadid=39973

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
Help: UDF Used in Conditional Format not Initialized Dan Excel Programming 1 July 27th 05 04:20 AM
how to check that a var type date is initialized ?? François Excel Programming 3 July 16th 05 07:15 PM
Listbox initialized on workbook load Kandi Excel Programming 5 December 21st 04 05:19 PM
ImageList must be initialized What-a-Tool Excel Programming 6 October 27th 04 12:39 AM
listbox value not initialized John Holland Excel Programming 2 November 25th 03 07:57 PM


All times are GMT +1. The time now is 04:00 PM.

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"