Option
Explicit
Private
m_rngSearchList
As
Excel.Range
Private
Sub
ComboBox1_Change()
If
ComboBox1.ListIndex < 0
Then
Exit
Sub
TextBox1.Value = m_rngSearchList.Cells(1 + ComboBox1.ListIndex, 2).Value
End
Sub
Private
Sub
CommandButton1_Click()
If
ComboBox1.ListIndex < 0
Then
Exit
Sub
m_rngSearchList.Cells(1 + ComboBox1.ListIndex, 2).ClearContents
TextBox1.Value =
""
End
Sub
Private
Sub
UserForm_Initialize()
With
Worksheets(
"Tabelle1"
)
Set
m_rngSearchList = .Range(
"A1"
, .Cells(.Rows.Count,
"A"
).
End
(xlUp))
End
With
ComboBox1.RowSource = m_rngSearchList.Address(External:=
True
)
End
Sub
Private
Sub
UserForm_Terminate()
Set
m_rngSearchList =
Nothing
End
Sub