vba - Excel - Adding multiple columns after last column in chart -


i'm trying create macro in excel add 3 columns end of chart, identical previous columns found in chart 1 of columns increasing one.

for example:

column 1         column 2   column 3    column 4         column 5   column 6 pgm number 1     amount     notes       pgm number 2     amount     notes 

is there way add 3 columns (pgm number +1, amount , notes) @ end of chart, can following?

column 7      column 8   column 9       column 10      column 11   column 12 pgm number 3     amount     notes       pgm number 4      amount       notes 

this code have replicate last column:

sub insertcolumn() dim lastcolumn long lastcolumn = activesheet.range("a1").specialcells(xlcelltypelastcell).column columns(lastcolumn).copy destination:=columns(lastcolumn + 1) end sub 

but not enough.

thank help!

sub addcols()  dim lastcolumn long dim f string dim s string dim t string dim c long  f = "pgm number " s = "amount" t = "notes"  activesheet      lastcolumn = .cells(1, .columns.count).end(xltoleft).column     c = (lastcolumn + 3) / 3      'assuming first row, otherwise change "1" desired row     .cells(1, lastcolumn + 1) = f & c     .cells(1, lastcolumn + 2) = s     .cells(1, lastcolumn + 3) = t  end  end sub 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -