skus tento kod, ZALOHUJ SI ORGINALY, "undo alebo zpet" nefubguje, je to na 54 riadkov, este skusam elegantnejsiu verziu , ale to az potom co toto bude OK
ak by to neslo budem potrebovat zopar orginal pomenovanych listov
Sub spoj_listy()
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Sheets(1).Select
Sheets.Add
Sheets(1).Select
x = 1
For Each llist In ActiveWorkbook.Sheets
Cells(x, 1).Value = llist.Name
x = x + 1
Next llist
Rows("1:1").Select
Selection.Delete Shift:=xlUp
Range("B1").Select
ActiveCell.FormulaR1C1 = "=LEFT(RC[-1],SEARCH(""_"",RC[-1])-1)"
Selection.AutoFill Destination:=Range(Cells(1, 2), Cells(ActiveSheet.UsedRange.Rows.Count, 2)), Type:=xlFillDefault
Range(Cells(1, 2), Cells(ActiveSheet.UsedRange.Rows.Count, 2)).Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Columns("A:A").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
For riadok = 2 To ActiveSheet.UsedRange.Rows.Count
If Cells(riadok, 1).Value = Cells(riadok - 1, 1).Value Then
Rows(riadok).Delete
riadok = riadok - 1
End If
If Cells(riadok, 1).Value = "" Then GoTo kk
Next riadok
kk:
pocetlistov = ActiveSheet.UsedRange.Rows.Count
For riadok = 1 To pocetlistov
Sheets(1).Select
menolistu = Cells(riadok, 1).Value
Sheets(2).Select
Sheets.Add
Sheets(2).Select
Sheets(2).Name = menolistu
Next riadok
Sheets(1).Select
ActiveWindow.SelectedSheets.Delete
For x = 1 To pocetlistov
For Each llist In ActiveWorkbook.Sheets
If InStr(1, llist.Name, "_") = 0 Then GoTo ky
If Sheets(x).Name = Left(llist.Name, InStr(1, llist.Name, "_") - 1) Then
llist.Activate
Range(Cells(1, 1), Cells(54, 11)).Select
Selection.Copy
Sheets(x).Activate
Cells(Range("h36556").End(xlUp).Row + 2, 1).Select
ActiveSheet.Paste
End If
ky:
Next llist
Next x
End Sub
citovat