简体   繁体   中英

use a cell value as text in vba formula

I have a variable in cell B1 that will update a file name in a formula - here is what I have:

\\GROUPS\GROUPS\R\Reports Dashboard\DC Daily Processing\[2018632_DC Daily Processing.xls]Virginia'!A1

The variable is 2018632 - this will change daily and the daily value will be in cell B1.

I have this code but cannot return the value - it brings up the open file box as if the file name is incorrect

Sheet1.Cells(1, 1) = "= '\\GROUPS\GROUPS\R\Reports Dashboard\DC Daily Processing\[" & Cells(2, 1) & "_DC Daily Processing.xls]Virginia'!RC"

I need help with the proper syntax to pull in B2 as text into the formula

I would also like to loop this so that all cells in sheet Virginia populate on my Sheet1

尝试这个

Sheet1.Cells(1, 1).value = "= '\\GROUPS\GROUPS\R\Reports Dashboard\D2 Daily Processing\[" & Cells(2, 1).value & "_D2C Daily Processing.xls]Virginia'!RC"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM