Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I wamt to make third option button where is possible to choose both horse
and pig. Whta I need to change in my code? If .OptionButton1 Then sOne = "Horse" Else sOne = "Pig" |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is it on a userform? If so, then
If Me.OptionButton1.Value Then sOne = "Horse" Else sOne = "Pig" End If -- HTH RP (remove nothere from the email address if mailing direct) "Alen32" wrote in message lkaboutsoftware.com... I wamt to make third option button where is possible to choose both horse and pig. Whta I need to change in my code? If .OptionButton1 Then sOne = "Horse" Else sOne = "Pig" |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I have 3 optionbutton 1.Horse 2.Pig 3.Both This work only for first 2 buttons. What to change so third one also work? If Me.OptionButton1.Value Then sOne = "Horse" Else sOne = "Pig" End If |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Do you mean
If Me.OptionButton1.Value Then sOne = "Horse" ElseIf Me.Optionbutton2.Value Then sOne = "Pig" ElseIf Me.Optionbutton3.Value sOne = "Horse & Pig" End If -- HTH RP (remove nothere from the email address if mailing direct) "Alen32" wrote in message lkaboutsoftware.com... I have 3 optionbutton 1.Horse 2.Pig 3.Both This work only for first 2 buttons. What to change so third one also work? If Me.OptionButton1.Value Then sOne = "Horse" Else sOne = "Pig" End If |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
sorry I have difuculties to explain in english what I want. I got this code
here which works well. Now I want to make third optionbutton where user can choose both horse and pig. That means program should look for either horse or pig in the samme row. and if program find either horse or pig in one row + sTwo and Sthree insert that row in listbox. With UserForm1 If Me.OptionButton1.Value Then sOne = "Horse" ElseIf Me.OptionButton2.Value Then sOne = "Pig" ?????ElseIf Me.OptionButton5.Value Then sOne = "Horse Or Pig" ???????? End If If .OptionButton3 Then sTwo = "Danish" Else sTwo = "Foreign" End If sThree = .TextBox1.Text End With With Worksheets(1).Cells Set c = .Find(sOne, 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 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How about this
With UserForm1 If .OptionButton1.Value Then sOne = "Horse" sOnePlus = "" ElseIf .OptionButton2.Value Then sOne = "Pig" sOnePlus = "" ElseIf .OptionButton5.Value Then sOne = "Horse" sOnePlus = "Pig" End If If .OptionButton3 Then stwo = "Danish" Else stwo = "Foreign" End If sThree = .TextBox1.Text End With With Worksheets(1).Cells Set c = Nothing Set c = .Find(sOne, LookIn:=xlValues) If c Is Nothing And stwo < "" Then Set c = .Find(sOnePlus, 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 If End With -- HTH RP (remove nothere from the email address if mailing direct) "Alen32" wrote in message lkaboutsoftware.com... sorry I have difuculties to explain in english what I want. I got this code here which works well. Now I want to make third optionbutton where user can choose both horse and pig. That means program should look for either horse or pig in the samme row. and if program find either horse or pig in one row + sTwo and Sthree insert that row in listbox. With UserForm1 If Me.OptionButton1.Value Then sOne = "Horse" ElseIf Me.OptionButton2.Value Then sOne = "Pig" ?????ElseIf Me.OptionButton5.Value Then sOne = "Horse Or Pig" ???????? End If If .OptionButton3 Then sTwo = "Danish" Else sTwo = "Foreign" End If sThree = .TextBox1.Text End With With Worksheets(1).Cells Set c = .Find(sOne, 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 |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This makro doesn't fill listbox.
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
keep source formatting is not an option in paste option button | Excel Discussion (Misc queries) | |||
Getting value of Option button | Excel Discussion (Misc queries) | |||
Option Button | Excel Discussion (Misc queries) | |||
Option Button Value | Excel Programming | |||
VBA - Option Button | Excel Programming |