Hi Guys I have a question regarding lookups. I am using this code to do an index and match. the Mon_qu_sa_A are named cells / ranges.
The code essentially works as intended with one exception the variable intPmtFreq in the formula once vba is ran says just monthly and so the cell shows #NAME ?. I can fix this manually by putting "" around monthly so monthly becomes "monthly". but how do I get vba to automatically put "" around the variable.
ActiveCell.Formula = "=INDEX(mon_qu_sa_A,MATCH(" & intPmtFreq & ",MMQSAA,0),MATCH(" & monthCheckPmts & ",inv_horiz,0))"
The code essentially works as intended with one exception the variable intPmtFreq in the formula once vba is ran says just monthly and so the cell shows #NAME ?. I can fix this manually by putting "" around monthly so monthly becomes "monthly". but how do I get vba to automatically put "" around the variable.
ActiveCell.Formula = "=INDEX(mon_qu_sa_A,MATCH(" & intPmtFreq & ",MMQSAA,0),MATCH(" & monthCheckPmts & ",inv_horiz,0))"