excel - After pasting an array, I want to paste a new array next to the first one -
i have automatic procedure works great
private sub worksheet_change(byval target range) if not intersect(target, range("a:a, l:l")) nothing on error goto fìn application.enableevents = false dim long, n long dim arrmatrix variant redim arrmatrix(1 1, 1 1) = 2 cells(rows.count, 1).end(xlup).row if cells(i, 12).value = "pi emitida" n = n + 1 redim preserve arrmatrix(1 1, 1 n) arrmatrix(1, n) = cells(i, 1).value end if next worksheets("inicio") .range("g4:g" & rows.count).clearcontents .range("g4").resize(ubound(arrmatrix, 2), 1) = application.transpose(arrmatrix) end end if fìn: application.enableevents = true end sub my problem want same , paste different array in colum next first one, array must same if these conditions achieved:
dim hoy date hoy=date if cells(j, 12).value = "pi emitida" or cells(j, 12).value = "pi firmada" or cells(j, 12).value = "carta credito l/c" or cells(j, 12).value = "con booking" , hoy - cells(j, 12).value >= 0
private sub worksheet_change(byval target range) dim long, n long, dim j long, m long dim arrmatrix() variant, dim arrmatrix1() variant if not intersect(target, range("a:a, l:l")) nothing ' on error goto fìn 'commented find out line error - uncomment once fixed application.enableevents = false = 2 cells(rows.count, 1).end(xlup).row if cells(i, 12).value = "pi emitida" n = n + 1 redim preserve arrmatrix(1 1, 1 n) arrmatrix(1, n) = cells(i, 1).value end if if (cells(i, 12).value = "pi emitida" or cells(i, 12).value = "pi firmada" or cells(i, 12).value = "carta credito l/c" or cells(i, 12).value = "con booking") , datediff(d, cells(i, 17).value, today) > 0 m = m + 1 redim preserve arrmatrix1(1 1, 1 m) arrmatrix1(1, m) = cells(i, 1).value end if next worksheets("inicio") .range("g4:g" & rows.count).clearcontents .range("g4").resize(ubound(arrmatrix, 2), 1) = application.transpose(arrmatrix) .range("h4:h" & rows.count).clearcontents .range("h4").resize(ubound(arrmatrix1, 2), 1) = application.transpose(arrmatrix1) end end if fìn: application.enableevents = true end sub
Comments
Post a Comment