Thread: Vlookup
View Single Post
 
Old 12-22-2011, 01:57 AM
Catalin.B Catalin.B is offline Windows Vista Office 2010 32bit
Expert
 
Join Date: May 2011
Location: Iaşi, Romānia
Posts: 386
Catalin.B is on a distinguished road
Default

You can use a macro to do this, and you will not have formulas in the user file, just results, which means a smaller size.
use :
Code:
Sub getvalues()
Dim Path  As String, Myrange As Range, ShName As Worksheet, Wb As Workbook

Path = ThisWorkbook.Path ' put your server path
Wb = Path & "\filename.xlsx"
Myrange = "A9:R7915"

Select Case ActiveSheet.Cells(6, "C")
Case 7
ShName = Sheets("July-Data")
ActiveSheet.Cells(21, "C") = Application.VLookup(F5, Wb.ShName.Myrange, 5, False)
Case 8
ShName = Sheets("Aug-Data")
ActiveSheet.Cells(21, "C") = Application.VLookup(F5, Wb.ShName.Myrange, 5, False)
Case 9
ShName = Sheets("Sep-Data")
ActiveSheet.Cells(21, "C") = Application.VLookup(F5, Wb.ShName.Myrange, 5, False)
Case Else
End Select
End Sub
Modify this code to fill a range with this formula result. There might be some errors, i did not have the time to test it, it's just to give you a clue.
Reply With Quote