Good afternoon,
I am wondering if it is possible to use the worksheets and cells functions within a formula as a cell location reference instead of a value. Please see below for what I currently have and ultimately what I would like to end up with to avoid any columns, worksheet name changes, or worksheets being added.
Variable y are the number of columns in the original document. This forumla is going to be 2 columns to the right of the last column in the original document.
Range(Cells(2, y + 2), Cells(x, y + 2)).Formula = "=INDEX('Cat. Table'!$C$2:$C$" & z & ",MATCH(N2,'Cat. Table'!$A$2:$A$" & z & ",0))"
Is it possible to have the following as the N2 location may eventually change if new columns are added.
Range(Cells(2, y + 2), Cells(x, y + 2)).Formula = "=INDEX('Worksheets(2)!$C$2:$C$" & z & ",MATCH(Cells(2,y+2),'Worksheets(2)'!$A$2:$A$" & z & ",0))"
When I enter Cells(2,y+2) it returns the value in the previous cell; ultimately, I would like it to return the cell location, in this case N2.
Thanks.
Bookmarks