rvphx
rvphx

Reputation: 2402

Selecting a cell in Excel based on variable containing the row number

How would I select a cell based on a variable beginPosition containing the row number. For example if my beginPosition variable is 10, how would I select cell A10?

I tried using the Range function, but that is not working very well (erroring out).

Upvotes: 6

Views: 93871

Answers (2)

kim
kim

Reputation: 121

Use INDIRECT function

e.g if cell A1 has 4 the function =INDIRECT("C"&A1) will return the contents of cell C4.

http://www.freelists.org/post/mso/ExcelVariable-cell-reference,5

Upvotes: 12

Francis P
Francis P

Reputation: 13655

Range("A" & beginPosition).Select

Upvotes: 11

Related Questions