It's very convenient to use numbers for rows and columns when dealing with the Excel cells in VB. But there doesn't appear to be a way to convert numerical row/column (R1C1) to alphanumeric cell address (A1). Here's one way to do so:
- Private Function ConvR1C1ToAddr(pRow, pCol) As String
- ConvR1C1ToAddr = Range(Cells(pRow, pCol), Cells(pRow, pCol)).Address
- End Function
Since the column names can go from "A" to some like "CXZ", it's hard to build that without a lot of code.
For going the other way, simply use Range("A1").Row and Range("A1").Column.
No comments:
Post a Comment