vlookup klappt nicht:-(
18.05.2005 20:12:19
Reinhard
ich sitze hier seit ewigen zeiten an dem Code und hänge fest, schon das erste vlookup wird bemängelt, 1004 Fehler.
J1 wird gefüllt als LinkedCell durch ein Steuerlement aus A2:A5, kann also gar nicht falsch geschrieben sein. Klar könnte ich mit der Schleife die Spalte A runter, aber nach 50 Minuten Kampf will ich mein vlookup haben :-)
Private Sub ComboBox1_Change()
Set ws1 = Worksheets("Rechnung")
With Worksheets("Kunden")
.Activate
ws1.[B5] = Application.WorksheetFunction.VLookup(.[J1], .Range("A2:I" & .Range("a65536").End(xlUp).Row), 2, 0) & " "
ws1.[B5] = ws1.[B5] & Application.WorksheetFunction.VLookup(.[J1], .Range("A2:I" & .Range("a65536").End(xlUp).Row), 4, 0) & " "
ws1.[B5] = ws1.[B5] & Application.WorksheetFunction.VLookup(.[J1], .Range("A2:I" & .Range("a65536").End(xlUp).Row), 3, 0)
ws1.[B6] = Application.WorksheetFunction.VLookup(.[J1], .Range("A2:I" & .Range("a65536").End(xlUp).Row), 5, 0) & " "
ws1.[B7] = ws1.[B5] & Application.WorksheetFunction.VLookup(.[J1], .Range("A2:I" & .Range("a65536").End(xlUp).Row), 6, 0) & " "
ws1.[B8] = Application.WorksheetFunction.VLookup(.[J1], .Range("A2:I" & .Range("a65536").End(xlUp).Row), 7, 0)
ws1.[B9] = Application.WorksheetFunction.VLookup(.[J1], .Range("A2:I" & .Range("a65536").End(xlUp).Row), 8, 0)
ws1.[B10] = Application.WorksheetFunction.VLookup(.[J1], .Range("A2:I" & .Range("a65536").End(xlUp).Row), 9, 0)
End With
End Sub
Private Sub ComboBox1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
ComboBox1.ListFillRange = "Kunden!$A$2:$A$" & Worksheets("Kunden").[a65536].End(xlUp).Row
End Sub
Tabellenblattname: Kunden
A B C D E J
1 Anrede Name Vorname Straße 10003
2 10001 Herr Müller Max Testweg 11
3 10002 Firma Herrmann Schmitt Postfach 1111
4 10003 Frau Weber Irgendwo 4
Gruß
Reinhard, der jetzt mal zum Abschalten von vlookup Bier trinken geht