vb.net - Excel find the sum of every 6th column in a loop -
i have excel sheet have inserted blank columns through macro need find sum of every 6 columns , store values in empty column? trying step 7 7 isnt working. need empty columns have average of last 6 columns
the code have tried is
sub sum_of_every_6th_column() dim ilastcol integer ilastcol = cells(1, columns.count).end(xltoleft).column ' same ctrl+right arrow colx = 7 ilastcol step 8 '?? unable understand can come here next end sub
try code, alter per needs,
sub sumcols() dim long, j long, k long j = 0 k = 1 cells(rows.count, 1).end(xlup).row = 1 cells(k, columns.count).end(xltoleft).column + 1 if isempty(cells(k, i)) cells(k, i) = j j = 0 else j = j + cells(k, i) end if next next k end sub
Comments
Post a Comment