Define range between two page breaks excel VBA -
i have excel sheet separated multiple page breaks - each change in column c (column c represents specific projecid).
each line of table contains amount has been spent. amount stored in column q. (note - each project there can multiple rows - amounts in column q).
depending if subtotal amount (column q) per project (column c) <0 or >0, different operations should performed within range.
question - how loop through these ranges (between 2 page breaks) in order check subtotal amount , perform appropriate operations on rows within each range?
thank in advance
following code deletes previous page & can set range,
sub pagebreak() dim cellrange range dim testcell range set cellrange = selection each testcell in cellrange activesheet.rows(testcell.row).pagebreak = xlpagebreaknone if testcell.value <> testcell.offset(-1, 0).value activesheet.rows(testcell.row).pagebreak = xlpagebreakmanual end if next testcell end sub
nb: select cells want splits, don't count col headings, if country name in column d rows 2 through 30, select range in d3 through d30.
Comments
Post a Comment