Excel VBA to make a sequence of cells equal to a value. Convert annual dummy into quarterly -
how can write function or macro in order convert annual dummy variable quarterly?
want: suppose in cell a1 have value 0, want b(1:4) 0. a2 = 0, want b(5:8) 0. a3 =1 b(8:11) =1 , on 5000 cells in column. appreciated!
ok, try this.
public sub fillcell() dim row, brow, startrow, endrow integer startrow = 1 endrow = 4 sheets("sheetname") 'looping 1 5000, increase 1 row = 1 5000 step 1 brow = startrow endrow .range("b" & brow) = .range("a" & row) next brow startrow = startrow + 4 endrow = endrow + 4 next row end end sub
Comments
Post a Comment