excel - Double-click autofill - dynamic based on adjacent cell -


i need do:

excel autofill

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:

enter image description here

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:

enter image description here


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:

enter image description here


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c++ - Using OpenSSL in a multi-threaded application -

All overlapping substrings matching a java regex -