LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #14   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default option button-if else?

I got answer :
Private Sub CommandButton1_Click()
Dim sOne, sOneItem
With UserForm1
'******
If .OptionButton1 Then sOne = Array("Horse")
If .OptionButton2 Then sOne = Array("Pig")
If .OptionButton5 Then sOne = Array("Horse", "Pig")
'******
If .OptionButton3 Then
sTwo = "Danish"
Else
sTwo = "Foreign"
End If
sThree = .TextBox1.Text
End With

'******
For Each sOneItem In sOne
'******
'MsgBox sOneItem
With Worksheets(1).Cells
Set c = .Find(sOneItem, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
If Application.CountIf(c.EntireRow, "*" & sTwo & "*") And _
Application.CountIf(c.EntireRow, "*" & sThree & "*")
Then
UserForm1.ListBox1.AddItem c.Value
UserForm1.ListBox1.List( _
UserForm1.ListBox1.ListCount - 1, 1) _
= c.Offset(0, 2).Value
UserForm1.ListBox1.List( _
UserForm1.ListBox1.ListCount - 1, 2) _
= c.Offset(0, 5).Value
End If
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With
'******
Next
'******
End Sub

 
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
keep source formatting is not an option in paste option button Tina Excel Discussion (Misc queries) 0 February 20th 06 09:58 PM
Getting value of Option button BG Excel Discussion (Misc queries) 2 September 27th 05 01:47 PM
Option Button Fable Excel Discussion (Misc queries) 1 August 16th 05 01:59 AM
Option Button Value ExcelMonkey[_190_] Excel Programming 1 February 20th 05 12:48 AM
VBA - Option Button ajliaks[_19_] Excel Programming 1 May 5th 04 02:56 AM


All times are GMT +1. The time now is 02:16 AM.

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

About Us

"It's about Microsoft Excel"