Referencing a cell in the current row

  • I have a button that adds a new row to a table and enters formulas into certain cells. The full code follows:








    End Sub


    I need the following formula to always reference the "J" column and whatever row was just added:


    Code
    table_object_row.Range(1, 5).Formula "=IF(J**CURRENTROW**>3,""GO"",""NO GO"")"


    Ive tried using" & DestRow " but it is not working. But I may have it entered incorrectly.


    I was able to record the following macro and, although it works, I receive an error everytime the button is pressed:


    Code
    ActiveCell.FormulaR1C1 = "=IF(RC[4]>=3,""GO"",""NO GO"")"Range("F6").Select



    Thank you for the help.

  • Re: Referencing a cell in the current row


    You could try this, if it doesn't work you should consider posting your sheet and I bet I could figure it out. I don't see this particular formula in your code.



    Code
    table_object_row.Range(1, 5).Formula "=IF(J" & Selection.Row & ">3,""GO"",""NO GO"")"
  • Re: Referencing a cell in the current row


    Thanks for the help. That code returned an error. I am unable to upload an image of my worksheet. It is a small .png file but it will not upload.


    Everytime a row is added, Cell 5 in the row needs to reference cell 9 in that same row.

  • Re: Referencing a cell in the current row


    You need you to upload the spreadsheet not a picture.

    Quote from 0zero0;737682

    Thanks for the help. That code returned an error. I am unable to upload an image of my worksheet. It is a small .png file but it will not upload.


    Everytime a row is added, Cell 5 in the row needs to reference cell 9 in that same row.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!