Guten Tag liebe VBA Gemeinde,
ich habe folgendes Problem. Ich schreibe ein Programm, welches nach Eingabe einer bestimmten String Kombination, bestimmte Werte aus einer seperaten Excel Datei liefern soll.
Mein Code sieht bisher so aus:
Function Masterliste(Arg1 As String, Arg2 As String) As String
Dim column As Integer
Dim row As Integer
columm = 1
row = 3
'Select Colum depending on Arg1
Select Case Arg1
Case "irgendwas"
Debug.Print "test"
Dim strPath As String, strFile As String
strPath = [pfad zu der auszulesenden Excel Datei]
strFile = "20170922_Masterliste EVA2.xlsm"
Masterliste = GetValue(strPath, strFile, "Tabelle1", "A3")
Case "irgendwas anderes"
End Select
End Function
Private Function GetValue(ByVal path As String, ByVal file As String, ByVal sheet As String, ByVal ref As String) As String
Dim Arg As String
Arg = "'" & path & "\[" & file & "]" & sheet & "'!" & Range(ref).Address(, , xlR1C1)
GetValue = ExecuteExcel4Macro(Arg)
End Function
|