ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Vlookup file location changes depending on value within cell (https://www.excelbanter.com/excel-worksheet-functions/95908-re-vlookup-file-location-changes-depending-value-within-cell.html)

vane0326

Vlookup file location changes depending on value within cell
 

Hope this helps.

1.) Enter date in cell G12

( 052406 )

2.) Enter your formula in cell K12 without the equal sign, I substitute
your file name with "date"

VLOOKUP(N17,'C:\Documents and
Settings\mstege\Desktop\PaymentechTemp\[date.xls]date'!$A$2:$Z$29,26,FALSE)

3.) Enter this formula in cell M12

="="&(SUBSTITUTE(K12,"date",$G12))


4.) Copy this code and right click on your worksheet tab and paste it
onto the white area and close it.


Code:
--------------------
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("G12")) Is Nothing Or Target.Cells.Count 1 Then Exit Sub
If Target.Cells.Count 1 Then Exit Sub

Range("I12").Value = Range("M12").Value

End Sub
--------------------



Now change the date in cell G12 you wil get your result. It will place
your formula in cell I12.


--
vane0326
------------------------------------------------------------------------
vane0326's Profile: http://www.excelforum.com/member.php...o&userid=14731
View this thread: http://www.excelforum.com/showthread...hreadid=545993



All times are GMT +1. The time now is 11:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com