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
Post a Comment