excel - Naming sheets and copying data based on cell names -


i have database created following information: company, worksite, element name, date, number, , few columns numerical values.

thing need create new worksheet (that's easy), worksheets named after unique company/worksite information (that's hard part). after sheets created, need whole information regarding each combination database copied there respective worksheets (also not sure how it). worst part company/worksite name longer 31 characters, can't directly use full names move within sheets.

is possible ?

i count unique company/worksite rows, , copy them whole, while creating new worksheet index. still have no idea how deal naming.

edit: had free time on hands, , decided work on this.

    sub zaloz_arkusze()      application     .screenupdating = false     .enableevents = false     end      dim wbk3 workbook     dim wbk4 workbook     dim lw long     dim lr long     dim integer     dim j integer     dim test integer     dim rng range, rcell range, mytable range, mytable2 range     = 1     j = 4      'optimize macro speed       application.screenupdating = false       application.enableevents = false       application.displayalerts = false       application.calculation = xlcalculationmanual      set wbk3 = activeworkbook     set wbk4 = workbooks.open("c:\users\rzakrzewski\desktop\przeroby.xlsm")      wbk3.activate     set rng = range("a1", range("r" & rows.count).end(xlup))      lr = sheets(2).cells(rows.count, "s").end(xlup).row          sheets(2).range("q1:r" & lr).advancedfilter action:=xlfiltercopy, copytorange:=sheets(4).range("a1"), unique:=true     lw = sheets(4).range("b1", sheets(4).range("b1").end(xldown)).rows.count      set mytable = wbk3.sheets(4).range("b1", range("b1").end(xldown))     set mytable = wbk3.sheets(4).range("a1", range("a1").end(xldown))      test = mytable.rows.count      wbk3.sheets(2).activate      each rcell in mytable     on error resume next         wbk4.activate         wbk4.worksheets.add(after:=sheets(worksheets.count)).name =         wbk3.activate          rng             .autofilter , field:=18, criteria1:=rcell.value             .offset(1).specialcells(xlcelltypevisible).entirerow.copy _                 wbk4.sheets(j).range("a" & rows.count).end(xlup).offset(1)             .autofilter         end     on error goto 0     = + 1     j = j + 1  next rcell  application.enableevents = true      end sub 

the above sorts data according company/object name, copies unique entries , creates number worksheets in seperate workbook according number of unique entries. decided skip naming part according company/object. name length restriction makes hard make.

next part i'm trying figure out, copy data each unique combination , paste worksheets. ie. have unique data combination in cells b1:c6. need data in cells d1:t6 copied second workbook worksheet(1). have no idea select data require. ideas ?

edit2: show in above, tried work on autofilter option. problem is, need 2 step checking unique data. companies have lots of objects under them, , same object have different company. i've got no idea how make work. tried double "for each" loop, it's not working.

after create new worksheet can navigate using:

sheets("newworksheetname").range("a1")="data" 

Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -