excel - Check if row is within a certain Time Limit -
this macro checks if rows older 30 mins of , clears them if not. trying change:
loop until > lastrow to instead loop until reaches first row within 30 mins of (to reduce amount of computation machine struggling). i've tried variations on:
loop until .cells(i, "a") > timelimit but without luck. appreciated! context:
lastrow = range("a1").specialcells(xlcelltypelastcell).row ws1 = 1 timelimit = time - timeserial(0, 30, 0) if .cells(i, "a") < timelimit .cells(i, "a").entirerow.clearcontents end if = + 1 loop until > lastrow end end sub here's timer code needs go into:
sub update() sheets("data") rw = .cells(.rows.count, 1).end(xlup).row + 1 .range(.cells(rw, 1), .cells(rw, 6342)).value = sheets("data").range("a7:ijz7").value end application.ontime + timeserial(0, 0, 1), "update" end sub
try this:
option explicit sub clear() dim wb workbook dim ws1 worksheet dim lastrow long dim long dim timelimit date, chktime date set wb = thisworkbook set ws1 = wb.sheets("sheet1") lastrow = ws1.cells(rows.count, 1).end(xlup).row timelimit = time - timeserial(0, 30, 0) = 10 lastrow 'since data starts row 10 chktime = cdate(ws1.range("a" & i).value) if chktime < timelimit ws1.rows(i).entirerow.clearcontents else: end if next end sub also formatting col time format good.
Comments
Post a Comment