It would not really require a macro. If the user gives a cell then a sum could
be done using the offset or match function whatever might be the requirement.
eg the data is from A1 to b4000 and the user writes 650 meaning a1 to a650 then
a formula can be used on cell c2 as
=sum(a1:offset(a1,c1,0)