Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
1036to1040
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
Von Textbox 27 Werte in Textbox 29
09.01.2009 07:31:11
Heinz
Guten morgen Leute
Im unteren Code kann ich in Textbox27 eine 5 stellige Zahl eingeben,der mir dann im Worksheets("Artikeln") in Spalte A den übereinstimmenden Wert sucht.
Nun möchte ich aber das mir der Wert von Spalte B in Textbox29 anzeigt.
Z.B. Gebe in Textbox27 12345 ein, und diese Zahl befindet sich in ("Artikeln") in A50 nun sollte mir der Text von B50 in Textbox29 angezeigt werden.
Könnte mir bitte dazu jemand weiterhelfen ?
Gruß
Heinz
Option Explicit
Dim UF As New CUserForm
Dim Gelesen As Boolean

Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Sheets("Artikeln").Unprotect Password:="hh"
Dim A As Long, myRow
If TextBox27 = "" Then
MsgBox "Es wurde keine SAP Nummer eingegeben." ', vbCritical
TextBox27.SetFocus
TextBox27.Text = ""
MsgBox "Es wurde nichts übernommen." ', vbCritical
Exit Sub
Else
With Worksheets("Artikeln") 'Anpassen
myRow = Application.Match(CSng(TextBox27), .Columns(1), 0)
If IsNumeric(myRow) Then
For A = 1 To 26
If IsNumeric(Me("ComboBox" & A)) Then
.Cells(myRow, A + 26) = CDbl(Me("ComboBox" & A).Value)
Else
.Cells(myRow, A + 26) = Me("ComboBox" & A).Value
End If
Next A
Else
MsgBox "SAP-Nr. " & TextBox27 & vbLf & "ist nicht vorhanden", vbCritical
MsgBox "Es wurde nichts übernommen." ', vbCritical
TextBox27.SetFocus
TextBox27.Text = ""
Exit Sub
End If
End With
End If
Sheets("Artikeln").Protect Password:="hh"
MsgBox "Werte wurden eingetragen!"
'Unload Pruefung
For A = 1 To 26
Me("ComboBox" & A).Value = ""
Next A
TextBox27.SetFocus
TextBox27.Text = ""
Application.ScreenUpdating = True
End Sub



Private Sub TextBox27_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Application.ScreenUpdating = False
Dim A As Long, myRow
'   For A = 1 To 26
'      Me("TextBox" & A) = ""
'   Next A
If TextBox27  "" Then
If IsNumeric(TextBox27) Then
With Worksheets("Artikeln")
myRow = Application.Match(CSng(TextBox27), .Columns(1), 0)
If Len(TextBox27) = 5 And IsNumeric(myRow) Then
For A = 1 To 26
Me("ComboBox" & A).Value = .Cells(myRow, A + 26)
Next A
Gelesen = True
ElseIf Gelesen Then
For A = 1 To 26
Me("ComboBox" & A).Value = ""
Next A
Gelesen = False
End If
End With
Else
MsgBox "Text ist nicht zugelassen"
TextBox27 = ""
End If
'ElseIf Me.TextBox27  "" Then
'MsgBox "Text ist nicht zugelassen"
'TextBox27 = ""
'End If
End If
Application.ScreenUpdating = True
End Sub



Private Sub UserForm_Initialize()
Application.ScreenUpdating = False
Dim A As Long
With Sheets("Vorlage")
For A = 1 To 26
If .Cells(2, A)  "" Then
Me("ComboBox" & A).RowSource = "Vorlage!" & _
.Range(.Cells(2, A), .Cells(.Rows.Count, A).End(xlUp)).Address(0, 0)
End If
Next A
End With
With UF
.MaxButton = True
.MinButton = True
.BorderStyle = xlFest
.Create Me
End With
Application.ScreenUpdating = True
End Sub


2
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Von Textbox 27 Werte in Textbox 29
09.01.2009 10:25:02
fcs
Hallo Heinz,
mit folgender Anpassung sollten die Comboboxen und die Textbox29 mit Daten gefüllt werden.
Gruß
Franz

Private Sub TextBox27_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Application.ScreenUpdating = False
Dim A As Long, myRow
'   For A = 1 To 26
'      Me("TextBox" & A) = ""
'   Next A
If TextBox27  "" Then
If IsNumeric(TextBox27) Then
With Worksheets("Artikeln")
myRow = Application.Match(CSng(TextBox27), .Columns(1), 0)
If Len(TextBox27) = 5 And IsNumeric(myRow) Then
Me.Textbox29 = .Cells(myRow, 2).Text                     '#####
For A = 1 To 26
Me("ComboBox" & A).Value = .Cells(myRow, A + 26)
Next A
Gelesen = True
ElseIf Gelesen Then
Me.Textbox29 = ""                                         '#####
For A = 1 To 26
Me("ComboBox" & A).Value = ""
Next A
Gelesen = False
End If
End With
Else
MsgBox "Text ist nicht zugelassen"
TextBox27 = ""
Me.Textbox29 = ""                                           '#####
End If
'ElseIf Me.TextBox27  "" Then
'MsgBox "Text ist nicht zugelassen"
'TextBox27 = ""
'End If
End If
Application.ScreenUpdating = True
End Sub


Anzeige
AW: Von Textbox 27 Werte in Textbox 29
09.01.2009 10:37:00
Heinz
Hallo Franz
GRANDIOS - PERFEKT
Recht herzlichen DANK !!
Gruß
Heinz

311 Forumthreads zu ähnlichen Themen

Anzeige
Anzeige
Anzeige

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige