Consulting

Results 1 to 3 of 3

Thread: Set Integer to a Value

  1. #1
    VBAX Regular
    Joined
    Jun 2015
    Posts
    7
    Location

    Set Integer to a Value

    I'm working on growing a formula by one cell horizontally to change with the month that I am working in.

    In order to accomplish this I need to set the integer that I have found as a value that I can use in a formula (in the FormulaR1C1Local line, use the value of i instead of writing i).Is there a way to do this?

    Range("O5").Select
     Dim i As Integer
    i = -13 + Worksheets("Table of Contents").Range("H5") - 1
    MsgBox i
    FormulaR1C1Local = "=+SUM(RC[-13]:RC[i])"
    Range("O6").Select
    Range("O5").Select

    Thanks

  2. #2
    VBAX Expert
    Joined
    Aug 2004
    Posts
    810
    Location
    is this what you mean?

    FormulaR1C1Local = "=+SUM(RC[-13]:RC[" & i & "])"

  3. #3
    VBAX Regular
    Joined
    Jun 2015
    Posts
    7
    Location
    Yes thank you!

Tags for this Thread

Posting Permissions

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