View Single Post
 
Old 01-20-2017, 04:47 PM
NoSparks NoSparks is offline Windows 7 64bit Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 831
NoSparks is just really niceNoSparks is just really niceNoSparks is just really niceNoSparks is just really niceNoSparks is just really nice
Default

Quote:
Would you have any suggestion how to move referenced cell with this formulaR1C1?
No. But if you're willing to use a 'normal' formula, this macro along with the UDF, will put a drag-able formula into C6.
Code:
Sub MacroTest2()
    With Worksheets("List1")
        ro = Range("d2").Value
        col = Range("c2").Value
        .Range("C6").Formula = "=$" & ColumnLetter(CLng(col)) & ro
    End With
End Sub
Code:
Function ColumnLetter(ColumnNumber As Long) As String
    Dim n As Long, c As Byte, s As String
    n = ColumnNumber
    Do
        c = ((n - 1) Mod 26)
        s = Chr(c + 65) & s
        n = (n - c) \ 26
    Loop While n > 0
    ColumnLetter = s
End Function
Reply With Quote