excel - Export data in multiple columns into multiple sheets -


i export column data separate sheets export individual ascii text files. specific data shown whereby copy first 2 columns (x, y coordinates) , each individual column thereafter own sheet.

 x     y    comp1   comp2   comp3   comp4    …  comp23 -40  -20    55.29   0       0       73       …  105.67 -40  -19.9  56.79   0       33      72       …  112.5 -40  -19.8  69.29   0       31      89       …  114 -40  -19.7  70.29   0       58.14   108      …  125  …    …     …       …       …       …        …  …  40   55    72.29   0       49      117      …  132 

i'm still getting grips writing macros right trying adapt recorded macro 1 of iterations work entire sheet looks follows:

sub copycoldata()     activecell.range("a1:b1").select     range(selection, selection.end(xldown)).select     selection.copy     sheets.add after:=activesheet     activesheet.paste     sheets("sheet1").select     sheets("sheet1").name = "comp1"     sheets("sum").select     application.cutcopymode = false     activecell.offset(0, 2).range("a1").select     range(selection, selection.end(xldown)).select     selection.copy     sheets("comp1").select     activecell.offset(0, 2).range("a1").select     activesheet.paste end sub  

ideally create new worksheet each column coordinate data in first 2 columns, label worksheet according column title , copy column data onto third column. afterwards i'll export multiple sheets individual ascii files using different macro. thanks!

all jerry beaucaire (again!) added counter sheet naming:

option explicit  sub columnstosheets() 'author:    jerry beaucaire 'date:      8/7/2011 'summary:   create separate sheets columns of data sheet  dim wsdata   worksheet   'sheet data parse dim firstcol long        'this first column transfer dim colcnt   long        'this how many columns in group transfer dim lastcol  long        'check row1 see how many columns of data there dim newsht   long        'how many new sheets created dim inti integer         'counter sheet naming  firstcol = application.inputbox("which column first 'data column' transfer?" _     & vblf & "(a=1, b=2, c=3, etc...)" _     & vblf & "(all columns left appear on every sheet)", _     "first data column", 2, type:=1) if firstcol = 0 exit sub  colcnt = application.inputbox("how many data columns in each group?", _     "groups of columns", 1, type:=1) if colcnt = 0 exit sub inti = 1 set wsdata = activeworkbook.sheets("sheet1") application.screenupdating = false    wsdata     lastcol = .cells(1, .columns.count).end(xltoleft).column     newsht = firstcol lastcol step colcnt         sheets.add , after:=sheets(sheets.count)         .columns(1).resize(, firstcol - 1).copy range("a1")         .columns(newsht).resize(, colcnt).copy cells(1, firstcol)         activesheet.name = "comp" & inti         inti = inti + 1     next newsht   end application.screenupdating = true end sub   

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -