Consulting

Results 1 to 2 of 2

Thread: Using R1C1 formula referencing other WB and SH

  1. #1
    VBAX Regular
    Joined
    Jun 2014
    Posts
    19
    Location

    Using R1C1 formula referencing other WB and SH

    Hi guys,

    I am using the following code to attach a formula as a string to a cell.


    strFormula = "='[" & wbCustomerFile.Name & "]" & shPS.Name & "'!AL2"

    It is returning this value in the cell.

    ='[Total 1.xlsx]NR'!'AL2'
    Which is the correct notation...sort of. I need it to get rid of the last ' and the ' after the !.

    What am i missing here?

    Let me know.

    Thanks,

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    Try using the Immediate window to view results of debug.print. I don't see those characters being added.
    Sub ken()
        Dim strFormula As String
      strFormula = "='[" & ThisWorkbook.Name & "]" & ActiveSheet.Name & "'!AL2"
      Debug.Print strFormula
    End Sub

Posting Permissions

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