ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   using a macro to move a function into excel cell (https://www.excelbanter.com/excel-programming/299689-re-using-macro-move-function-into-excel-cell.html)

Bob Phillips[_6_]

using a macro to move a function into excel cell
 
Deb,

Try this

Worksheets("Reformatted Data").Range("D1").Formula = _
"=INDEX(INDIRECT(""'Downloaded Data'!$A$1:$H$&'Start
Here'!$E$11"")," _
"MATCH(I3,INDIRECT(""'Downloaded Data'!$I$1:$I$&'Start
Here'!$E$11"),0),4)"


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Deb" wrote in message
...
The function works in Excel. But, when VB encounters the first quote, it

thinks the rest is a comment. I renamed the spreadsheets to have a
one-level name so that I could remove the single quotes, but it still didn't
work. Help!!

Worksheets("Reformatted Data").Range("D1").Formula =

"=INDEX(INDIRECT("'Downloaded Data'!$A$1:$H$"&'Start
Here'!$E$11),MATCH(I3,INDIRECT("'Downloaded Data'!$I$1:$I$"&'Start
Here'!$E$11),0),4)"



Bob Phillips[_6_]

using a macro to move a function into excel cell
 
Sorry, I meant

Worksheets("Sheet1").Range("D1").Formula = _
"=INDEX(INDIRECT(""'Downloaded Data'!$A$1:$H$&'Start
Here'!$E$11"")," & _
"MATCH(I3,INDIRECT(""'Downloaded Data'!$I$1:$I$&'Start
Here'!$E$11""),0),4)"


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Bob Phillips" wrote in message
...
Deb,

Try this

Worksheets("Reformatted Data").Range("D1").Formula = _
"=INDEX(INDIRECT(""'Downloaded Data'!$A$1:$H$&'Start
Here'!$E$11"")," _
"MATCH(I3,INDIRECT(""'Downloaded Data'!$I$1:$I$&'Start
Here'!$E$11"),0),4)"


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Deb" wrote in message
...
The function works in Excel. But, when VB encounters the first quote,

it
thinks the rest is a comment. I renamed the spreadsheets to have a
one-level name so that I could remove the single quotes, but it still

didn't
work. Help!!

Worksheets("Reformatted Data").Range("D1").Formula =

"=INDEX(INDIRECT("'Downloaded Data'!$A$1:$H$"&'Start
Here'!$E$11),MATCH(I3,INDIRECT("'Downloaded Data'!$I$1:$I$"&'Start
Here'!$E$11),0),4)"





deb

using a macro to move a function into excel cell
 
Bob - This worked!! Thank you very much!! Wahoo!


All times are GMT +1. The time now is 12:12 PM.

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