JenniferMurphy
Well-known Member
- Joined
- Jul 23, 2011
- Messages
- 2,550
- Office Version
- 365
- Platform
- Windows
I am working on a macro that will process data in a table. It also needs to access data in cells in rows above the table. Here's the code so far.
How can I access the contents of the cell that is 3 rows above the cell in TblData(2,3)?
If TblData(2,3) is cell F7, then I want the contents of F3.
I know I could assign a named range to the cells in row 3, but a named range (eg C3:H3) does not automtically expand if I add a column, whereas the table range does.
Thanks
VBA Code:
Sub WtdRtg()
Const rnTable As String = "Tbl" 'The name of the main table
Dim TblData
TblData = Range(rnTable).Value
End Sub
How can I access the contents of the cell that is 3 rows above the cell in TblData(2,3)?
If TblData(2,3) is cell F7, then I want the contents of F3.
I know I could assign a named range to the cells in row 3, but a named range (eg C3:H3) does not automtically expand if I add a column, whereas the table range does.
Thanks