excel - Double-click autofill - dynamic based on adjacent cell -
i need do:

i using normal auto-fill function in excel (double click dot on side of cell) copy contents sub cells, in case clicking dot in cell a1 this:

i need script repeat process down entire column, until there no more values in adjacent cell.
presumably you're looking for:
option explicit sub fillintheblanks() dim startcell range, endcell range set startcell = activecell set endcell = activesheet.cells(activesheet.usedrange.rows.count + 1, startcell.offset(0, 1).column).end(xlup) dim currenttext string dim long = startcell.row endcell.row if not isempty(activesheet.cells(i, startcell.row)) currenttext = activesheet.cells(i, startcell.row).text else activesheet.cells(i, startcell.row).value = currenttext end if next end sub that code perform following:

if want what's in screenshot, you'll need this:
option explicit sub fillintheblanks() dim startcell range, endcell range, nextcell range set startcell = activecell set endcell = cells(activesheet.usedrange.rows.count + 1, startcell.offset(0, 1).column).end(xlup) while startcell.row < endcell.row set nextcell = startcell.offset(1, 1).end(xldown).offset(0, -1) startcell.autofill destination:=activesheet.range(startcell, nextcell), type:=xlfilldefault set startcell = nextcell.offset(1, 0) wend end sub which this:

Comments
Post a Comment