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).
Usage notes. The ROW function returns the row number for a cell or range. For example, =ROW(C3) returns 3, since C3 is the third row in the spreadsheet. When no reference is provided, ROW returns the row number of the cell which contains the formula.
To use a range or a single cell as a variable, first, you need to declare that variable with the range data type. Once you do that you need to specify a range of a cell to that variable using the range object. This also gives you access to all the properties and methods that you can use with a range.
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
Range("A" & beginPosition).Select
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With