KcrazyCowboy
New Member
- Joined
- Jun 13, 2016
- Messages
- 33
- Office Version
- 2010
- Platform
- Windows
- MacOS
- Mobile
I am trying to get dates from one of two worksheets in a workbook (not same workbook I am working on)
I found this code, but it only works on ActiveWorkbook (guessing it means the workbook I am on) how can I change it to reflect the workbook I needed to go on.
Dim wSheet As Worksheet
Dim vFound
On Error Resume Next
For Each wSheet In ActiveWorkbook.Worksheets
With wSheet
Set Tble_Array = .Range(Tble_Array.Address)
vFound = WorksheetFunction.VLookup _
(Look_Value, Tble_Array, _
Col_num, Range_look)
End With
If Not IsEmpty(vFound) Then Exit For
Next wSheet
Set Tble_Array = Nothing
VLOOKAllSheets = vFound
End Function
I found this code, but it only works on ActiveWorkbook (guessing it means the workbook I am on) how can I change it to reflect the workbook I needed to go on.
Dim wSheet As Worksheet
Dim vFound
On Error Resume Next
For Each wSheet In ActiveWorkbook.Worksheets
With wSheet
Set Tble_Array = .Range(Tble_Array.Address)
vFound = WorksheetFunction.VLookup _
(Look_Value, Tble_Array, _
Col_num, Range_look)
End With
If Not IsEmpty(vFound) Then Exit For
Next wSheet
Set Tble_Array = Nothing
VLOOKAllSheets = vFound
End Function