vba - Looping through each column of excel and dragging formula down by one cell each -


i'm new vba , know how stuff it. seen in table below, drag formula down 1 cell each column data expands on time. there quick , efficient way me loop through each column doing drag down action automatically?

example

code assumes formula in cell 2 of column

option explicit  sub autofill() dim rng range dim ws worksheet dim y  set ws = sheets("sheet1")  'range set rng = ws.range("a1:" & ws.range("a1").end(xltoright).address)  'looping each y in rng  'autofilling, note split function retreiving letter range    ws.range(split(cells(, y).address, "$")(1) & "2").autofill destination:=ws.range(split(cells(, y).address, "$")(1) & "2:" & split(cells(, y).address, "$")(1) & ws.range("a1").specialcells(xlcelltypelastcell).row) next y  end sub 

Comments

Popular posts from this blog

'hasOwnProperty' in javascript -

python - ValueError: No axis named 1 for object type <class 'pandas.core.series.Series'> -

java - How to provide dependency injections in Eclipse RCP 3.x? -