Live-Forum - Die aktuellen Beiträge
Datum
Titel
19.04.2024 12:23:24
19.04.2024 11:45:34
Anzeige
Archiv - Navigation
996to1000
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

OptionButton zur Auswahl

OptionButton zur Auswahl
06.08.2008 18:22:39
Peter
Hallo wertes Forum
ich habe da mal eine Frage und bitte um Hilfe
ich habe eine Userform wo eine combobox6 mit daten gefüllt ist.
wähle ich eine Datensatz aus so bekomme ich einen wert in einem Textfeld3 und Textfeld19
zurückgegeben.
jetzt möchte ich mit 2 OptionButton anklicken welches textfeld (3 oder 19 ) seinen Wert an das Textfeld 7
weitergibt.
Bisher hatte ich nur ein Textfeld so das keine Auswahl nötig war
Danke vorab für die Hilfe
Gruß Peter
Hier die werte für die Combobox und dazu der wert für das textfeld:

Private Sub ComboBox6_Change()
'Kategorie 20
If ComboBox6 = 5000 Then TextBox3.Value = CCur(130)
If ComboBox6 = 7000 Then TextBox3.Value = CCur(155)
If ComboBox6 = 9000 Then TextBox3.Value = CCur(165)
If ComboBox6 = 11000 Then TextBox3.Value = CCur(175)
If ComboBox6 = 13000 Then TextBox3.Value = CCur(205)
If ComboBox6 = 15000 Then TextBox3.Value = CCur(215)
If ComboBox6 = 17000 Then TextBox3.Value = CCur(250)
If ComboBox6 = 19000 Then TextBox3.Value = CCur(260)
If ComboBox6 = 21000 Then TextBox3.Value = CCur(275)
If ComboBox6 = 23000 Then TextBox3.Value = CCur(310)
If ComboBox6 = 25000 Then TextBox3.Value = CCur(325)
'Kategorie 25
If ComboBox6 = 5000 Then TextBox19.Value = CCur(180)
If ComboBox6 = 7000 Then TextBox19.Value = CCur(210)
If ComboBox6 = 9000 Then TextBox19.Value = CCur(220)
If ComboBox6 = 11000 Then TextBox19.Value = CCur(230)
If ComboBox6 = 13000 Then TextBox19.Value = CCur(260)
If ComboBox6 = 15000 Then TextBox19.Value = CCur(270)
If ComboBox6 = 17000 Then TextBox19.Value = CCur(305)
If ComboBox6 = 19000 Then TextBox19.Value = CCur(315)
If ComboBox6 = 21000 Then TextBox19.Value = CCur(330)
If ComboBox6 = 23000 Then TextBox19.Value = CCur(365)
If ComboBox6 = 25000 Then TextBox19.Value = CCur(375)
If ComboBox6  "" Then TextBox7.Value = CCur(ComboBox6)
Dim a As Long, b As Long
a = CCur(TextBox3)
TextBox7 = TextBox3
End Sub


4
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: OptionButton zur Auswahl
06.08.2008 19:50:00
Uduuh
Hallo,
so sollte das klappen:

Private Sub ComboBox6_Change()
Dim a As Long, b As Long
'Kategorie 20
Select Case ComboBox6.Value
Case 5000
TextBox3.Value = CCur(130)
TextBox19.Value = CCur(180)
Case 7000
TextBox3.Value = CCur(155)
TextBox19.Value = CCur(210)
Case 9000
TextBox3.Value = CCur(165)
TextBox19.Value = CCur(220)
Case 11000
TextBox3.Value = CCur(175)
TextBox19.Value = CCur(230)
Case 13000
TextBox3.Value = CCur(205)
TextBox19.Value = CCur(260)
Case 15000
TextBox3.Value = CCur(215)
TextBox19.Value = CCur(270)
Case 17000
TextBox3.Value = CCur(250)
TextBox19.Value = CCur(305)
Case 19000
TextBox3.Value = CCur(260)
TextBox19.Value = CCur(315)
Case 21000
TextBox3.Value = CCur(275)
TextBox19.Value = CCur(330)
Case 23000
TextBox3.Value = CCur(310)
TextBox19.Value = CCur(365)
Case 25000
TextBox3.Value = CCur(325)
TextBox19.Value = CCur(375)
If ComboBox6  "" Then
If optionbutton1 = True Then
TextBox7.Value = CCur(ComboBox6)
ElseIf optionbutton2 = True Then
TextBox7.Value = CCur(ComboBox19)
End If
End If
a = CCur(TextBox3)
TextBox7 = TextBox3
End Sub


Gruß aus’m Pott
Udo

Anzeige
AW: OptionButton zur Auswahl
06.08.2008 20:17:32
Erich
Hallo Peter,
warum verwendest du CCur für die Textbox-Einträge?
Textboxen (und Combobox-Zeilen) enthalten einfach nur Texte.
Etwas unklar ist, wie die Elemente der UF zusammen wirken sollen.
Wird in die Conobox etwas eingegeben oder kann nur eine Zeile ausgewählt werden?
Bei Eingaben würde ..._Change bei jedem Tastendruck laufen.
Reicht es nicht, die Combobox erst beim Exit auszuwerten?
Nach Verlassen der Combobox ist klar, was in den beiden Textboxen stehen soll.
Danach muss per OptionButton entschieden werden, welcher Wert in die dritte Textbox kommt.
Soll die Entscheidung immer neu getroffen werden, oder soll die letzte Auswahl stehen bleiben?
Probier mal

Option Explicit
Private Sub OptionButton1_Click()
DoIt
End Sub
Private Sub OptionButton2_Click()
DoIt
End Sub
Private Sub DoIt()
If OptionButton1 Then TextBox7 = TextBox3 Else TextBox7 = TextBox19
End Sub
Private Sub ComboBox6_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Select Case ComboBox6
Case 5000:  TextBox3 = "130": TextBox19 = "180"
Case 7000:  TextBox3 = "155": TextBox19 = "210"
Case 9000:  TextBox3 = "165": TextBox19 = "220"
Case 11000: TextBox3 = "175": TextBox19 = "230"
Case 13000: TextBox3 = "205": TextBox19 = "260"
Case 15000: TextBox3 = "215": TextBox19 = "270"
Case 17000: TextBox3 = "250": TextBox19 = "305"
Case 19000: TextBox3 = "260": TextBox19 = "315"
Case 21000: TextBox3 = "275": TextBox19 = "330"
Case 23000: TextBox3 = "310": TextBox19 = "365"
Case 25000: TextBox3 = "325": TextBox19 = "375"
'     Case Else:  TextBox3 = "0":   TextBox19 = "0"   ' oder wie sonst?
End Select
OptionButton1 = False
OptionButton2 = False
TextBox7 = ""
End Sub
Private Sub ComboBox6_Change()      ' kann gelöscht werden
End Sub

Hier eine Spiel-Mappe: https://www.herber.de/bbs/user/54388.xls
Rückmeldung wäre nett! - Grüße von Erich aus Kamp-Lintfort

Anzeige
AW: OptionButton zur Auswahl
06.08.2008 22:52:00
Peter
Hallo
hat super geklappt danke
Gruß Peter Knierim

AW: OptionButton zur Auswahl
06.08.2008 22:51:11
Peter
Hallo
es hat wunderbar geklappt kann jetzt in meiner Tabelle weiterfeilen
Vielen vielen Dank
Gruß Peter Knierim

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige