excel - Program code is deleting the data which I want to keep -
i have macro consolidate values on sheet, , based on these values, it´s has go on first sheet , delete. macro deleting want keep.
the macro: sub deleteothers()     dim r1 range, c range     dim t string      sheets("sheet2")         set r1 = .range(.cells(2, "h"), .cells(rows.count, "h").end(xlup))     end      each c in r1         if c.text = "<<<keep row"             sheets("sheet1").select             t = c.offset(0, -1)             rows(t).clearcontents         end if     next end sub      
change to:
if c.text <> "<<<keep row"      
Comments
Post a Comment