Consulting

Results 1 to 3 of 3

Thread: Solved: keeps crashing on this code

  1. #1
    VBAX Master
    Joined
    Jun 2006
    Posts
    1,091
    Location

    Solved: keeps crashing on this code

    [VBA]lngIndOverHead = Range("B67").Value
    Range("B67").FormulaR1C1 = "=R[-66]C*.01" + lngIndOverHead[/VBA]

    It keeps crashing on the second line of code. I don't know why? I have tried a few different ways. I need to replace the value in a field with a formula that relates to itself and that is why I used the variable, so I do not get a circular reference.
    Thank You,
    Daniel Blois
    http://studenthacker.blogspot.com/

  2. #2
    VBAX Regular
    Joined
    Jan 2006
    Posts
    28
    Location

    Smile

    Good afternoon Djblois

    You are trying to add the variable into the formula - but you need to add the value of the variable into the formula instead. Try this code :
    lngIndOverHead = Range("B67").Value
    Range("B67").FormulaR1C1 = "=R[-66]C*.01+" & lngIndOverHead
    HTH

    DominicB

  3. #3
    VBAX Master
    Joined
    Jun 2006
    Posts
    1,091
    Location
    Thank you very much. I tried with the ampersand but I did not know it also needed a plus sign in the quotes.
    Thank You,
    Daniel Blois
    http://studenthacker.blogspot.com/

Posting Permissions

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