2 Varianten
12.06.2010 12:55:00
CitzenX
Hallo Jochen
hier mal 2 Möglichkeiten:
Modul des Arbeitsblattes
Option Explicit
'wenn nur die Nummer ausgegeben werden soll
'******************************************************************************************
'
Private Sub Worksheet_Change(ByVal Target As Range)
'Dim Bereich As Integer
'Dim lngLastRow As Long
'If Target.Column = 1 And Selection.Count = 1 Then
' Application.EnableEvents = False
' With Sheets("Tabelle2")
' lngLastRow = .Cells(Rows.Count, 1).End(xlUp).Row
' On Error Resume Next
' Bereich = Application.Match(Target, .Range(.Cells(1, 1), .Cells(lngLastRow, 1)))
' Target = .Cells(Bereich, 2)
' End With
' Application.EnableEvents = True
'End If
'End Sub
'wenn Name und Nummer ausgegeben werden soll
'******************************************************************************************
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Bereich As Integer
Dim lngLastRow As Long
If Target.Column = 1 And Selection.Count = 1 Then
Application.EnableEvents = False
With Sheets("Tabelle2")
lngLastRow = .Cells(Rows.Count, 1).End(xlUp).Row
On Error Resume Next
Bereich = Application.Match(Target, .Range(.Cells(1, 1), .Cells(lngLastRow, 1)))
Target = Target & " " & .Cells(Bereich, 2)
End With
Application.EnableEvents = True
End If
End Sub
Grüße
Steffen