I am trying to write a macro that will look at a date I enter and then write a formula based on that date to pull up the correct file. Here is what I have so far to test the idea.
But the problem is whenever I run the macro it adds ' ' markes around the L58 reference so it looks like this
='N:\WFM\PSG\Comcast\Trending\[Comcast Agent Need Forecasting AHT Trend 062011.xlsx]Interval Call Volumes'!'L58'
rather than this
='N:\WFM\PSG\Comcast\Trending\[Comcast Agent Need Forecasting AHT Trend 062011.xlsx]Interval Call Volumes'!L58
Eventually I will have it use this formula to auto fill in the intervals and days for the rest of the week but I can't seem to figure out why the macro is adding the ' ' marks. I have tried all sorts of versions of the formula including
but it still adds the ' ' around L58. Is there a way to make this work? My other option will be to make the user select the file from a list then have it pull up the file and reference the cells manually which I would rather avoid.
Code:
Date1 = " " & Range("AS124").Value
Range("AS126").Select
ActiveCell.FormulaR1C1 = "='N:\WFM\PSG\Comcast\Trending\[Comcast Agent Need Forecasting AHT Trend" & Date1 & ".xlsx]Interval Call Volumes'!L58"
But the problem is whenever I run the macro it adds ' ' markes around the L58 reference so it looks like this
='N:\WFM\PSG\Comcast\Trending\[Comcast Agent Need Forecasting AHT Trend 062011.xlsx]Interval Call Volumes'!'L58'
rather than this
='N:\WFM\PSG\Comcast\Trending\[Comcast Agent Need Forecasting AHT Trend 062011.xlsx]Interval Call Volumes'!L58
Eventually I will have it use this formula to auto fill in the intervals and days for the rest of the week but I can't seem to figure out why the macro is adding the ' ' marks. I have tried all sorts of versions of the formula including
Code:
ActiveCell.FormulaR1C1 = "='N:\WFM\PSG\Comcast\Trending\[Comcast Agent Need Forecasting AHT Trend" & Date1 & ".xlsx]Interval Call Volumes'" & "!" & "L" & "58"
but it still adds the ' ' around L58. Is there a way to make this work? My other option will be to make the user select the file from a list then have it pull up the file and reference the cells manually which I would rather avoid.