VBA Excel auto select space delimited data range for formula use -


fairly new programming. have data in excel delimited empty cell @ top , bottom of each group (example, a1=empty, a2=a number, a3= number, a4= number, a5=empty, a6=a number, a7=a number, a8=empty) pattern repeats thousands of rows.

i use vba take sum of numbers between each set of empty cells , place value 6 cells right of top-most empty cell each group.

i hand, there ton of data. needs continue until reaches 2 empty cells in row(signifies end of data). in advance

here example should help:

sub sumgroups()     dim long ' rows counter     dim j long ' first row of current group, having empty cell     dim s double ' summ     = 1 ' start row     until cells(i, 1).value = "" ' loop first group begin         = + 1 ' next row     loop     j = ' new group start     s = 0             if cells(i, 1).value = "" ' empty cell found             if j = - 1 exit ' finish if previous cell empty             cells(j, 2).value = s ' put calculated summ @ top of group             j = ' new group start             s = 0         else  ' value cell found             s = s + cells(i, 1).value ' add each value in group         end if         = + 1 ' next row     loop end sub 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -