excel - Moving rows based on column value -
excel - Moving rows based on column value -
i have spreadsheet, , if info in column b matches value, want cutting , insert entire row top of spreadsheet.
this have far:
cells.find("trch").select activecell.entirerow.select selection.cut range("7:7").select selection.insert application.cutcopymode = false
this code works, finds first instance of trch. need alter rows containing trch inserted starting @ row 7?
thanks in advance!
i've updated screenshots. first illustration original set of data. sec illustration want after run macro. code above moves first row trch top. hope clarifies.
this hasn't been tested, problems or questions code allow me know:
dim wks worksheet dim lrow long set wks = thisworkbook.activesheet 'loop through each row 1 lastly row in used range lrow = 1 wks.usedrange.rows.count if ucase(wks.cells(lrow, 2)) = "trdm" 'check if cell contains trdm 'if there match cutting current row , insert row 7 wks.rows(lrow).cut wks.range("7:7") end if next
excel vba
Comments
Post a Comment