excel - VBA code to overwrite cells through moving /shifting up a range of cells -


hi there have data table, seen picture, changes time time. example if there new data coming march'15 have copy , overlap cells april'14 onwards march'14. thereafter fill in information march'15 on blank cell filled feb'15 information. wondering if there vba code move or shift range preferred row of cells has existing data ( more of code overlap/ overwrrite cells through moving/shifting up) .
data table

was thinking of activecell.offset not sure if can shift range of cells.

in case, use simple loop copy values. last row (13) overwritten empty values of row 14.

public sub moveup()      dim sh worksheet     dim x long, y long      set sh = activesheet ' or specific sheet      ' 12 months     y = 2 13         ' 7 columns         x = 1 7             sh.cells(y, x) = sh.cells(y + 1, x)         next x     next y      sh.cells(13, 1)         .select         ' works if column contains dates (not strings)         .value = dateadd("m", 1, sh.cells(12, 1))     end  end sub 

remove dateadd line @ end if column contains strings, not dates.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -