AddressReferenceStyle

Change Address style from R1C1 to A1 or from A1 to R1C1.
Something I needed recently

CodeFunctionName
What is this?

Public

Tested

Original Work
Function AddressReferenceStyle(CellAddress, Optional ChangeTo_R1C1 = 1)
    ' Change the cell address from A4 to R4C1
    ' Or from R4C1 to A4
    ' ChangeTo_R1C1 = 1 to change from A4 to R4C1
    ' ChangeTo_R1C1 = 0 to change R1C1 to A1 style
    '
    Rett = CellAddress
   
    If ChangeTo_R1C1 = 1 Then
        Rett = Range(CellAddress).Address(1, 1, xlR1C1)
    Else
        Ro = Val(CutString(CellAddress, "R", "C", 1))
        Co = Val(CutString(CellAddress, "C", "", 1))
        If Ro > 0 And Co > 0 Then Rett = Cells(Ro, Co).Address(1, 1, xlA1)
    End If
    AddressReferenceStyle = Rett
End Function

CellAddress, Optional ChangeTo_R1C1 = 1

Views 120

Downloads 51

CodeID
DB ID