+ Reply to Thread
Results 1 to 13 of 13

r1c1 formulae for linked cell

  1. #1
    Registered User
    Join Date
    09-23-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    97

    r1c1 formulae for linked cell

    i need to link a cell to another cell in a document, it would take ages to do by hand so i wrtoe some formulae!

    Please Login or Register  to view this content.
    unfortunately this produces "application-defined or object defined error"

    now when i run it without the = sign as just paste as text not formulae i get a nice looking string of something like:

    M:\Television and Broadband\DATA_2\[Austria_cable.xls]'!be$47


    which looks about right to me

    what s wrong with my code?

    thanks

    Jonathan

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: r1c1 formulae for linked cell

    You've used the FormulaR1C1 property and then passed an A1 format formula.

    Incidentally, what is column "**" supposed to be? (there appears to be a gap in your column sequence - is that correct? If not, then your code can be simplified a lot by just using a-4 as the column, instead of clet.)
    Remember what the dormouse said
    Feed your head

  3. #3
    Registered User
    Join Date
    09-23-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    97

    Re: r1c1 formulae for linked cell

    Hi,

    there was not supposed to be a gap in the column but is didn't know how else to do it

    also how would i go about passing an A1 formula to a cell?


    thanks

    Jonathan

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: r1c1 formulae for linked cell

    You would use the Formula property, not the FormulaR1C1 property, but here it's easier to adjust the formula you pass into R1C1 notation:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-23-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    97

    Re: r1c1 formulae for linked cell

    hey thanks,

    that looks much more concise then my code

    but i still get the error on the line

    Cells(r, a - 4).FormulaR1C1 = "='M:\Television and Broadband\DATA_2\[" & country & "_cable.xls]" & cvalue & "'!R47C" & a - 4

  6. #6
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: r1c1 formulae for linked cell

    What are the c, cothers and total variables supposed to be? They don't appear to have values assigned - are they public?

  7. #7
    Registered User
    Join Date
    09-23-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    97

    Re: r1c1 formulae for linked cell

    oooops

    yeah they are part of a filename

    i should have "" around them!

  8. #8
    Registered User
    Join Date
    09-23-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    97

    Re: r1c1 formulae for linked cell

    saying that.. when i correct this i still get the same error!

  9. #9
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: r1c1 formulae for linked cell

    Are you sure the formula string is correct - i.e. workbook and sheet names both definitely tie up? Also, I assume the sheet you are trying to add the formula to is not protected and that the source workbook is also not password protected?

  10. #10
    Registered User
    Join Date
    09-23-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    97

    Re: r1c1 formulae for linked cell

    hi,

    yeah i tried using a formula that i know to work instead of the generated one and that refuses to play ball as well

  11. #11
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: r1c1 formulae for linked cell

    Well, those are the only things I can think of, and I can't verify them - you'll have to do that. What you could do is enter a working formula manually, then with that cell selected, enter:
    Please Login or Register  to view this content.
    in the Immediate Window in the VBEditor and compare that to the string being produced by your code.

  12. #12
    Registered User
    Join Date
    09-23-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    97

    Re: r1c1 formulae for linked cell

    hmm why i try that i get a "method not valid without suitable object" error!

  13. #13
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: r1c1 formulae for linked cell

    What did you have selected at the time, and where did you enter the code?

+ 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