VBA EDITOR CODE

Hi,

I am inputting a formula via the editor. My formula in the editor is

 ActiveCell.FormulaR1C1 = _
  "=TEXT(MID(CELL(""filename"",A1),FIND(""-"",CELL(""filename"",A1),1)+2,FIND(""]"",CELL(""filename"",A1),1)-(FIND(""-"",CELL(""filename"",A1),1)+2)-4),""yyyymmdd"")"

When it places it in excel, it puts apostrophes (') around Cells A1 which causes a name error

How can avoid this?

Thanks
Seamus
Seamus2626Asked:
Who is Participating?
 
jppintoConnect With a Mentor Commented:
Change this:

ActiveCell.FormulaR1C1

to just this:

ActiveCell.Formula

jppinto
0
 
Seamus2626Author Commented:
Thanks!
0
 
nike_golfCommented:
Use ampersands and quotes... try this.

 ActiveCell.FormulaR1C1 = _
  "=TEXT(MID(CELL(" & Filename & ",A1),FIND(""-"",CELL(" & Filename & ",A1),1)+2,FIND(""]"",CELL(" & Filename & ",A1),1)-(FIND(""-"",CELL(" & Filename & ",A1),1)+2)-4),""yyyymmdd"")"


NG,



0
 
Seamus2626Author Commented:
Thank you too Nike Golf

Seamus
0
 
EdmoroCommented:
Use ActiveCell.Formula intead of ActiveCell.FormulaR1C1 and try it
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.