Option Explicit

Sub x()
    Dim v1 As Variant
    Dim iBeg As Long
    Dim iEnd As Long
    
    ' however v1 gets initialized ...
    v1 = Range("A1:A10").Value
    iBeg = Range("C2").Value
    iEnd = Range("D2").Value
    
    ' then ...
    With Range("B1").Resize(UBound(v1)) ' or any other convenient place
        .Value = v1
        MsgBox WorksheetFunction.Sum(Range(.Cells(iBeg), .Cells(iEnd)))
    End With
End Sub