excel - VBA to Sum a Column from a fixed cell up until the first blank cell -


i have column of numeric data, need sum values specified cell, down last value before first blank cell in column. have used range function complete this, on occasion number of rows before blank cell unknown , cannot defined in range. simple explanation need result in cell a1 be

=sum (a6:ax) 

where x 1 before first blank cell.

i write vba loop complete nth columns on nth sheets.

use following sub:

sub sumtillblankcell() dim beforefirstblankcell    beforefirstblankcell = range("a6").end(xldown).row   range("a1").value = application.sum(range("a6:a" & beforefirstblankcell))  end sub 

Comments