Consulting

Results 1 to 4 of 4

Thread: Indirect Cell references from VBA gives error

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Newbie
    Joined
    Jun 2018
    Posts
    2
    Location

    Indirect Cell references from VBA gives error

    I am using Excel 2010

    I am down to my last bit of code to finish my project. I needed to move this from a cell, to a macro .
    "C" is the static column, and cell G4 contains the row number, which is input by my users.

    This takes a current number (K4) and adds the number of items my user has input to be added to it (N3).
    This is a simple inventory spreadsheet and I can't believe I am stuck.

    Here is what I have currently, that errors with: 'Compile error: Sub or Function not defined' referencing INDIRECT within the RANGE selection line.

    -------------------------------
    Option Explicit
    dim rr as integer
    dim ss as integer
    dim add as integer

    Sub UpdateQuantityPositive()
    '
    ' Macro1 Macro
    '
    '
    rr = Range("K4").Value
    ss = Range("N3").Value
    add = ss + rr
    Range(INDIRECT("c" & G4)).Select
    ActiveCell.FormulaR1C1 = add

    End Sub

    ----------------------
    This is my first time posting and I have only done so since I can't find what I personally believe is going to be something I am looking too hard to find and should have known..
    I have searched the forum but nothing is indirectly referencing like I think I am doing... (sigh)
    Last edited by GeorgeC; 06-29-2018 at 06:39 AM. Reason: wrong variable...

Posting Permissions

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