Anzeige
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

Combobox

Forumthread: Combobox

Combobox
22.10.2008 13:45:07
John
Hallo Excel-Freunde,
habe ein Problem:
Ich möchte eine Combobox verwenden, um in eine Zelle bestimmte Zahlen zu übertragen.
Bei der Auswahl einer Zahl wird diese zwar in die "LinkedCell" übertragen,
jedoch in Textformat und nicht als Zahl.
Ist es möglich den übetragenen Wert generell als Zahl zu formatieren ?
Vielen Dank im voraus.
John
Anzeige

3
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Combobox
22.10.2008 14:04:32
Chris
Servus,
soweit ich weiß, wird bei LinkedCell immer Text übertragen, deswegen würde ich das per Change-Makro lösen:

Private Sub ComboBox1_Change()
If ComboBox1 = "" Then Exit Sub
If ComboBox1 = "-" Then
If Len(ComboBox1) = 1 Then Exit Sub
End If
If IsNumeric(ComboBox1) Then
Range("A1") = CDbl(ComboBox1)
Else
Range("A1") = ""
ComboBox1 = ""
End If
End Sub


Das Makro verhindert gleich noch die Eingabe nicht numerischer Werte.
Gruß
Chris

Anzeige
AW: kleine Nachbesserung
22.10.2008 14:27:00
Chris
Servus John,

Private Sub ComboBox1_Change()
If ComboBox1 = "" Then Range("D1") = "": Exit Sub
If ComboBox1 = "-" Then
If Len(ComboBox1) = 1 Then
Exit Sub
End If
End If
If ComboBox1 Like "*.*" Then ComboBox1 = "": Range("D1") = ""
If ComboBox1 Like "*-" Then ComboBox1 = "": Range("D1") = ""
If IsNumeric(ComboBox1) Then
Range("D1") = CDbl(ComboBox1)
Else
Range("D1") = ""
ComboBox1 = ""
End If
End Sub


Gruß
Chris

Anzeige
AW: kleine Nachbesserung
22.10.2008 14:51:50
John
Hallo Chris,
funktioniert einwandfrei !
Vielen Dank
John
;

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige