Codeänderung bei UF
10.08.2006 16:29:45
Maria
ich habe Dank dem Forum hier bereits den Nachfolgenden Code erhalten und habe da eine Bitte an Euch.
Zuerst mal mein Code:
--------------------------
Option Explicit
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim lngNext As Long
Dim intIndex As Integer
For intIndex = 1 To 8
If Len(Controls("TextBox" & intIndex).Value) = 0 Then
MsgBox "Es fehlen noch Angaben!", vbInformation, "Hinweis"
Controls("TextBox" & intIndex).SetFocus
Exit Sub
End If
Next
With Sheets("VVC 33")
lngNext = .Cells(101, 2).End(xlUp).Row + 2
If lngNext < 13 Then lngNext = 13
.Cells(lngNext, 4) = ""
lngNext = lngNext + 1
.Cells(lngNext, 2) = CLng(TextBox1)
.Cells(lngNext, 3) = CLng(TextBox2)
.Cells(lngNext, 5) = "=" & TextBox3 & "="
.Cells(lngNext + 1, 5) = ":" & UCase(Replace(TextBox4, ":", "")) & ":"
.Cells(lngNext + 1, 6) = "(" & Replace(Replace(TextBox5, "(", ""), ")", "") & ")"
.Cells(lngNext, 8) = TextBox6.Text
.Cells(lngNext, 9) = CLng(TextBox7)
.Cells(lngNext + 2, 4) = "ENDE " & Replace(TextBox8, "ENDE ", "")
For intIndex = 1 To 8
Controls("TextBox" & intIndex).Value = ""
Next
TextBox2 = Format(Application.Max(.Range("C14:C100")) + 1, "00")
End With
End Sub
Private Sub Label8_Click()
End Sub
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case 48 To 57
Case Else
KeyAscii = 0
End Select
End Sub
Private Sub TextBox5_Change()
End Sub
Private Sub TextBox7_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case 48 To 57
Case Else
KeyAscii = 0
End Select
End Sub
Private Sub TextBox8_Change()
End Sub
Private Sub UserForm_Activate()
Dim varList As Variant
varList = Array("BK", "L", "STK", "PKG", "KG")
TextBox2 = Format(Application.Max(Sheets("VVC 33").Range("C14:C100")) + 1, "00")
TextBox6.List = varList
End Sub
------------------------------
Und nun meine Bitte um Änderung wie folgt:
In der Textbox1 sollte immer die Zahl 33 stehen, die dann auch einegtragen werden sollte.
In der Textbox8 sollte der Wert aus Zelle F9 im Tabellenblatt mit dem Namen Grunddaten stehen.
Es ist aber so, das in besagter Zelle ein Name in Klammern steht so z.B.: (MUSTER, Mark)
Wenn es aber mittels UF in mein Formular eingetragen wird, sollte es ohne Klammern und wie folgt geschehen:
ENDE MUSTER, Mark
Und genau das sollte in der Textbox8 stehen.
Wichtig dabei, die Textbox1 und die Textbox8 sollten nie geleert werden.
Ich hoffe ich habe mich verständlich ausgedrückt und hoffe auf Eure Hilfe.
Recht herzlichen Dank im voraus.
Gruss aus Österreich