Hello there!

I'm the definition of a newbie so please be a bit paitent.

I have an Excel sheet with quite much information (about 13000 rows).
The interesting columns are A, D and E containing the following information:
- Column A contains a long list of names, all unique.
- Column D contains "group names".
- Column E contains Owners of the groups.
(Look at it as product names, product groups and responible persons for the groups.)
Row 1 contains the text "Names", "Group Names" and "Owners", the actual data starts at row 2.

What I want to do is:
1. Create a new sheet named "Owners" containing a list of all the group names and all owners associated with the groups.
2. Create a bunch of files named after the group names and the extention ".ext" e.g. <group1.ext>. containing the first row [Names] and then the all the names (one on each row) for that group listed below.

Example: ( [] = Cell)
[Names][ ][ ][Group Names][Owners]
[tcce1][ ][ ][group1 ][peter;john;sarah;]
[tcce2][ ][ ][group1 ][peter;john;liza;]
[rc_f ][ ][ ][group2 ][kent;sarah;]

This would result in a list on the Owners sheet looking like this:

[Group Name][Owners]
[group1 ][peter;john;sarah;liza]
[group2 ][kent;sarah;]

The file "group1.ext" (ordinary text file) should contain exactly the following:
[Names]
tcce1
tcce2

I'm using a form with two buttons to execute the 2 different Subs. I've managed to create a sheet named Owners and to create a list. The list is incorrect in some way though.

VB Code:
  1. Private Sub CmdButGenExtFiles_Click()
  2.  
  3. End Sub
  4.  
  5. Private Sub CmdButGenOwnList_Click()
  6.  
  7.     Dim rListPaste As Range
  8.     Dim ws As Worksheet
  9.    
  10.     For Each ws In Worksheets               'Check for Sheet with name "Owners"
  11.         If ws.name = "Owners" Then
  12.             MsgBox "There is a sheet with the name Owners already.", vbInformation
  13.             Exit Sub
  14.         End If
  15.     Next
  16.    
  17.     Sheets.Add After:=Sheets(Sheets.Count)  'Add new sheet
  18.     ActiveSheet.name = "Owners"             'Name it "Owners"
  19.     Range("A1").Select                          'Select cell A1
  20.     ActiveCell.FormulaR1C1 = "Group name:"    'and write Group name in it
  21.     Range("B1").Select                          'Select cell B1
  22.     ActiveCell.FormulaR1C1 = "Owners:"          'and write Owners in it
  23.  
  24.     Rows("1:1").Select                      'Select top Row and change font properties
  25.     With Selection.Font
  26.         .name = "Arial"
  27.         .Size = 14
  28.         .Bold = True
  29.         .Strikethrough = False
  30.         .Superscript = False
  31.         .Subscript = False
  32.         .OutlineFont = False
  33.         .Shadow = False
  34.         .Underline = xlUnderlineStyleSingle
  35.         .ColorIndex = xlAutomatic
  36.     End With
  37.    
  38.     Columns("B:B").ColumnWidth = 25         'Change Column widths
  39.     Columns("A:A").ColumnWidth = 25
  40.  
  41.     On Error Resume Next
  42.     Worksheets("Owners").Activate           'Activate sheet "Owners"
  43.     Set rListPaste = Range("A2")            'rListPaste = A2 at sheet Owners
  44.    
  45.     Worksheets("Data").Activate             'Select the Data sheet and paste the unique list
  46.    
  47.     Range("D2", Range("D2").End(xlDown)).AdvancedFilter _
  48.     Action:=xlFilterCopy, CopyToRange:=Worksheets("Owners").Range("A2"), Unique:=True
  49.  
  50. End Sub

I guess this is a quite massive problem to bring up in a forum, but all tips, ideas and help are greatly appreciated.

Best regards.