AW: userform
23.08.2008 10:53:00
Corinna
Hi Gerd!
Leider weiß ich mit deinem Befehl nicht viel anzufangen. Ich möchte eine Verknüpfung zwischen der ComboBox und dem Textfeld herstellen. Ich habe in der ComboBox Namen hinterlegt, die ich dann auswählen kann. Es gibt zu diesen Namen dazugehörige Kennziffern. Nun wäre es schön wenn ich einen Namen ausgewählt habe, das die dazugehörige Kennziffer auch gleich da steht (in der TextBox). Ist das möglich?
Mein kompletter Befehl für die Userform sieht so aus:
Private Sub BtnKaufen_Click()
Range("B10") = FldDatum.Value
Range("C10") = CbxAktie.Value
Range("D10") = FldWKN.Value
Range("E10") = FldAnzahl.Value
Range("F10") = FldKurs.Value
Range("G10") = FldKaufgebühr.Value
Unload Me
On Error Resume Next
Range("B10:K10").Select
Application.CutCopyMode = False
Selection.Copy
Range("B12:K12").Select
Selection.Insert Shift:=xlDown
Selection.Font.ColorIndex = 0
Range("B12:K12").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 35
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 35
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 35
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 35
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 35
End With
With Selection.Font 'Schrift grün einfärben...
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 50
End With
Range("B12:K12").Select 'Kopie der gekauften Aktie in das Gesamtarchiv
Application.CutCopyMode = False
Selection.Copy
Sheets("Gesamtarchiv").Select
Range("B12:K12").Select
Selection.Insert Shift:=xlDown
Selection.Font.ColorIndex = 0
ActiveSheet.Paste
With Selection.Font 'Schrift grün einfärben...
.Name = "Arial"
.FontStyle = "Standard"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 50
End With
Range("H12").Select
ActiveCell.FormulaR1C1 = "=RC[-3]*RC[-2]+RC[-1]" ' In der Aktiven Zelle soll die folgende _
Formel berechnet werden: E12*F12+G12
Range("H12").Select
Selection.NumberFormat = "#,##0.00 $" 'In Euro formatieren
Sheets("Archiv-Aktien").Select
Range("B12").Select
Range("B9:K10").Select
Selection.ClearContents 'entfernen von Zelleninhalt
Range("H12").Select
ActiveCell.FormulaR1C1 = "=RC[-3]*RC[-2]+RC[-1]" ' In der Aktiven Zelle soll die folgende _
Formel berechnet werden: E12*F12+G12
Range("H12").Select
Selection.NumberFormat = "#,##0.00 $" 'In Euro formatieren
End Sub
Private Sub BtnAbbrechen_Click()
Unload Me
End Sub
Private Sub BtnKurs_Click()
Follow_Link 'Homepage ansteuern
End Sub
Public Sub Follow_Link()
Dim objIE As Object
Dim strPage As String
Set objIE = CreateObject("InternetExplorer.Application")
strPage = "www.boerse.de/kurssuche.php"
With objIE
.Navigate strPage
.Visible = True
End With
Set objIE = Nothing
End Sub
Private Sub FldDatum_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Not IsDate(FldDatum) Then
FldDatum = ""
Else
FldDatum = Format(FldDatum, "dd.mm.yyyy")
End If
End Sub
Private Sub FldKurs_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Not IsNumeric(FldKurs) Then
FldKurs = ""
Else
FldKurs = Format(FldKurs, "#,##0.00 ")
End If
End Sub
Private Sub FldKaufgebühr_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Not IsNumeric(FldKaufgebühr) Then
FldKaufgebühr = ""
Else
FldKaufgebühr = Format(FldKaufgebühr, "#,##0.00 ")
End If
End Sub
Private Sub FldAnzahl_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Not IsNumeric(FldAnzahl) Then
FldAnzahl = ""
Else
FldAnzahl = Format(FldAnzahl, "0")
End If
End Sub
Private Sub UserForm_Click()
End Sub
Gruß Corinna