vba - Delete Row from Array -
i trying go through array find duplicate entries in single column of array , delete entire row.
i getting figuring out rangestart, rangeend, , lastrow above , part working fine.
data = range(rangestart, rangeend) = lastrow - 1 2 step -1 if data(i - 1, x) = data(i, x) 'delete data(i) end if next
any awesome!
sub removedups() const compare_col long = 1 dim a, anew(), nr long, nc long dim r long, c long, rnew long dim v string, tmp = selection.value nr = ubound(a, 1) nc = ubound(a, 2) redim anew(1 nr, 1 nc) rnew = 0 v = chr(0) r = 1 nr tmp = a(r, compare_col) if tmp <> v rnew = rnew + 1 c = 1 nc anew(rnew, c) = a(r, c) next c v = tmp end if next r selection.value = anew end sub
Comments
Post a Comment