Advertisement
vityata

VlookupClosedWb

May 16th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.56 KB | None | 0 0
  1. Option Explicit
  2.  
  3. Public Sub VlookupClosedWb(Optional strLookFor As String = "Erteilung Baugenehmigung", _
  4.                         Optional strSheet As String = "APF", _
  5.                         Optional lngColIndex As Long = 2)
  6.    
  7.     Dim strRange As String
  8.    
  9.     strRange = "'" & ThisWorkbook.Path & "\[" & strSheet & ".xlsx]" & "Monatsbericht'!$A:$E"
  10.     ActiveCell.Formula = "=VLOOKUP(""" & strLookFor & """," & strRange & "," & lngColIndex & ",0)"
  11.     'VlookupClosedWb = Evaluate(WorksheetFunction.VLookup(strLookFor, strRange, lngColIndex, 0))
  12.  
  13. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement