I have the code below and what it does is I have 2 summary sheets (Summary and Summary2). I have a rebuild code that whenever changes are made that would change the Summary sheet, the Summary sheet is copied to Summary2 as a backup copy. The code below keeps track of any changes made in columns G and I which are percentages based on whatever row it is on. So when I activate REBUILDSEL if any percetages that have been changed previously and automatically put back into the Summary sheet that is copied from Summary2.
Now what I need. After the summary is rebuilt anything after the total line is lost. So if any information is put after the Total line of the summary such as a breakdown of cost, is lost and not copied back over to the Summary sheet. Also be advised that these are text and formulas if that would make a difference. I could probably use a horizontal Vlookup but I've never used one. The additional information would start on the next blank row after the total row and in column E.
Sub Compare()
Worksheets("SUMMARY2").Visible = True
Sheets("SUMMARY").Select
Range("G3:G" & Cells(65536, "A").End(xlUp).Row).Select
Selection.FormulaR1C1 = _
"=IF(ISNA(VLOOKUP(RC[-6],SUMMARY2!C[-6]:C,7,0)),35,VLOOKUP(RC[-6],SUMMARY2!C[-6]:C,7,0))"
Range("I3:I" & Cells(65536, "A").End(xlUp).Row).Select
Selection.FormulaR1C1 = _
"=IF(ISNA(VLOOKUP(RC[-8],SUMMARY2!C[-8]:C,9,0)),35,VLOOKUP(RC[-8],SUMMARY2!C[-8]:C,9,0))"
Range("A1").Select
Worksheets("SUMMARY2").Visible = False
End Sub