+ Reply to Thread
Results 1 to 10 of 10

Apostrophe in formula comments the rest of the line

  1. #1
    Registered User
    Join Date
    05-08-2012
    Location
    Calgary
    MS-Off Ver
    Excel 2003
    Posts
    13

    Apostrophe in formula comments the rest of the line

    The apostrophe in this formula comments out the rest of the line:

    ActiveCell.FormulaR1C1 = _
    "=INDIRECT(CONCATENATE(" '[filename.xls]",$A$2,"'!$AQ$466"))"
    I've tried putting it in double quotes,
    "=INDIRECT(CONCATENATE(" "'"[MonthlyTracking.xls]",$A$2,""'"!$AQ$466"))"
    but it gives the error "expected end of statement"

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Apostrophe in formula comments the rest of the line

    Why are you using the concatenate function?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    05-08-2012
    Location
    Calgary
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Apostrophe in formula comments the rest of the line

    I'm accessing a sheet in a different file based on the sheet name (month by month it changes) so in march I want to access the march sheet, but in april I want to access the april sheet

    $A$2 contains the sheet name

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Apostrophe in formula comments the rest of the line

    The sheetname contained in A2 belongs to which file? The monthly tracking file?

  5. #5
    Registered User
    Join Date
    05-08-2012
    Location
    Calgary
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Apostrophe in formula comments the rest of the line

    yes, the monthly tracking file

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Apostrophe in formula comments the rest of the line

    Oops i missed out another element - what is the sheetname which contains A2?

  7. #7
    Registered User
    Join Date
    05-08-2012
    Location
    Calgary
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Apostrophe in formula comments the rest of the line

    SEMreport.xls

  8. #8
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Apostrophe in formula comments the rest of the line

    How can it be having an extension of .xls? Is the tab named SEMreport.xls?

  9. #9
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Apostrophe in formula comments the rest of the line

    you need to double all the quotes inside the formula
    Please Login or Register  to view this content.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  10. #10
    Registered User
    Join Date
    05-08-2012
    Location
    Calgary
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Apostrophe in formula comments the rest of the line

    Thanks for your help Arlu1201 and JosephP
    Joseph, your solution worked. Thank you

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1