I noticed you forgot the headings. I found some things wrong after I posted.
Try this instead
Sub NewList()
Dim StartRow As Long
Dim LastRow As Long
Dim Templatesh As Worksheet
Dim rng As Range, cell As Range
Dim bk As Workbook
StartRow = 2
Set Templatesh = ThisWorkbook.Worksheets("Template")
With ThisWorkbook.Worksheets("Sheet1")
MstBkName = ThisWorkbook.Name
LastRow = .Range("B" & 2).End(xlDown).Row
OldShtName = ""
OldBkName = ""
For RowCount = StartRow To LastRow
BkName = .Range("D" & RowCount).Value
ShtName = .Range("A" & RowCount).Value
If BkName <> OldBkName Then
ShtName = .Range("A" & RowCount).Value
'copy without after or before creates new workbook
Templatesh.Copy
Set newbk = ActiveWorkbook
Set NewSht = ActiveSheet
NewSht.Name = ShtName
NewSht.Range("A1") = 0
Data_2 = Evaluate("SUMPRODUCT(" & _
"--(" & MstBkName & "!A" & RowCount & "=" & MstBkName & _
"!A$1:A$" & LastRow & ")," & _
"--(" & MstBkName & "!D" & RowCount & "=" & MstBkName & _
"!D$1

$" & LastRow & ")," & _
MstBkName & "!C$1:C$" & LastRow & ")")
OldBkName = BkName
OldShtName = ShtName
Else
If ShtName <> OldShtName Then
Templatesh.Copy _
after:=newbk.Sheets(newbk.Sheets.Count)
Set NewSht = ActiveSheet
NewSht.Range("A1") = 0
NewSht.Name = ShtName
OldShtName = ShtName
End If
End If
'this is a trick
'keep overwriting data, only last write gets saved.
NewSht.Range("A1") = NewSht.Range("A1") + .Range("A" & RowCount)
NewSht.Range("B1") = Data_2
If BkName <> .Range("D" & (RowCount + 1)) Then
newbk.SaveAs "C:\My Document\Record\" & BkName & ".xlsx"
newbk.Close
End If
Next RowCount
End With
End Sub
"K" wrote:
> Sorry I have to repate as data text gone bit funny
>
> A B C D………col
> Worksheets Data_1 Data_2 Workbooks….hedings
> CC 100 200 JIM
> CC 100 200 JIM
> XX 100 200 JIM
> XX 100 200 JIM
> VV 100 200 KIM
> VV 100 200 KIM
> AA 100 200 KIM
> AA 100 200 KIM
> RR 100 200 SAM
>
> Thanks for replying joel, you been always very helpful. I want your
> help little more. Lets say if I have above data and required same
> thing which I mensioned in my above question but little different.
> What changes can be done in your macro so I can achive result (see
> below) according to above data.
> 1 - 3 Workbooks with name JIM , KIM & SAM (according to column D
> uniqre value)
> 2 - Workbook JIM should have 2 worksheets with name CC & XX
> (according
> to column A uniqre value)
> 2a - In cell A1 of Worksheet CC macro should put 200 and in cell B1
> fig should be 400. (these are the total amount from column B & C
> which
> appearing in next cell of sheet name)
> 2b - Same thing for Worksheet XX
> 3 - Prosses 2 , 2a & 2b should be repated on Workbook KIM & SAM
>
>
> I'll be very greatful if you can solve this for me.
>