(A10-A1)/(number of intervals-1)+A1
A function-like formulation that is dependent
only on the cell references of the 1st and last
"interval" would be:
=($A$10-$A$1)/(ROW($A$10)-ROW($A$1))+A1
Or...made even more invariant...
Oops...small bug! Should be...
Hi Rayan
Not too sure I have the formula syntax correct or not, but try this code.
Before you Run it select Cell A1 then holding down your Ctrl key select Cell A10. This will enable you to use it on a variable range.
Sub ReportIntervals()
'Written by OzGrid Business Applications
'www.ozgrid.com
'''''''''''''''''''''''''''''''''''''''''''''''''
'Reports interval between to single cell selections
'''''''''''''''''''''''''''''''''''''''''''''''''
Dim rCell1 As Range
Dim rCell2 As Range
Dim rFillRange As Range
Dim rAllCells As Range
Set rCell1 = Selection.Areas(1)
Set rCell2 = Selection.Areas(2)
Set rFillRange = Range(rCell1.Offset(1, 0), rCell2.Offset(-1, 0))
For Each rAllCells In rFillRange
rAllCells = (rCell2 - rCell1) / (rAllCells.Row - rCell1.Row) + rCell1
Next rAllCells
Set rCell1 = Nothing
Set rCell2 = Nothing
Set rFillRange = Nothing
End Sub
Dave
OzGrid Business Applications
Dave
Thanks Dave. i have been trying to this for a while but my VBA Knoweldge is very limited
Regards
Rayn
Glad it helped Rayn. Looks like my grammar knowledge is limited :o) "to" should be two
Dave
OzGrid Business Applications