kann mir jemand sagen, ob und wie ich VOR dem Ergebnis von vlookup einen Text anzeigen lassen kann?
hier der Code:
Private Sub Workbook_open()
Dim strPath As String, strSearch As String
strSearch = "Training"
strPath = ThisWorkbook.Path
strPath = Left(strPath, InStr(1, strPath, strSearch) + Len(strSearch))
On Error GoTo ErrExit
Application.Calculation = xlCalculationAutomatic
For Each Sheet In ThisWorkbook.Sheets
If Sheet.Name "Übersicht" Then
Sheet.Protect "KW", DrawingObjects:=True, Contents:=True, Scenarios:=True, _
userinterfaceonly:=True
End If
Next
Sheets("Übersicht").Visible = True
For Each Sheet In ThisWorkbook.Sheets
If Sheet.Name "Übersicht" Then
Sheet.Visible = False
End If
Next
Sheets("Übersicht").Select
ActiveSheet.Unprotect "KW"
Range("E1").Value = Application.UserName
'hier der Sverweis
With Range("B30") 'hier soll das Ergebnis in Textform und davor noch der Text "DRSA"
.Formula = "=VLookup(""" & Range("E3") & ",'" & _
strPath & "Auswertung\[Übersicht_PT.xls]Tabelle1'!K5:N200, 4, False)"
.Formula = .Value
End With
'der Rest ist unwichtig
Selection.AutoFilter _
Field:=1, Criteria1:=Range("F1").Value, Operator:=xlAnd
Range("A2:A201").Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("A2").Select
ActiveSheet.Protect "KW" ', userinterfaceonly:=True
'ActiveSheet.EnableSelection = xlUnlockedCells
ActiveSheet.EnableAutoFilter = True
ErrExit: ActiveSheet.Protect "KW" ', userinterfaceonly:=True
'ActiveSheet.EnableSelection = xlUnlockedCells
ActiveSheet.EnableAutoFilter = True
Exit Sub
End Sub
Das Ergebnis ist dann zum Beisp. :(Text vor dem Formelergebnis): "DRSA" (Formelergebnis in Textformat): "Silber" also: DRSA SilberDanke für jeden Tipp,
Gruß
Alex