Hi BehrBrew
I've added two Modules to your Sample Workbook and an additional Worksheet named "Template".
In order for the Code in Module Transfer to function properly the Formulas in the Individual Player sheets in Range("B3:F33") need to be cleared. This Code does that
Option Explicit
Sub Clear_Stuff()
Dim ws As Worksheet
Dim rng As Range
For Each ws In ThisWorkbook.Worksheets
If Not ws.Name = "MASTER" And Not ws.Name = "HIGH" And Not ws.Name = "AVERAGE" _
And Not ws.Name = "LOW" And Not ws.Name = "Template" Then
With ws
Set rng = .Range("B3:F33")
rng.ClearContents
End With
End If
Next ws
End Sub
The Code in Module Transfer is the Code that distributes the Master Records to the Individual Player sheets. The Code will add a new Worksheet for any new Player if the Individual Player sheet does not already exist. You'll receive a message that the New Player Sheet has been added. This Code runs from a Button on Master sheet.
Option Explicit
Sub Transfer_Data()
Dim ws As Worksheet
Dim rng As Range, cel As Range, myCell As String
Dim LR As Long
Dim NR1 As Long
Set ws = Sheets("Master")
With ws
LR = .Cells(5, 2).End(xlDown).Row
For Each cel In .Range("B5:B" & LR)
If Not WorksheetExists(cel.Text) Then
Worksheets.Add(Before:=Worksheets("HIGH")).Name = cel.Text
Sheets("Template").Cells.Copy
Sheets(cel.Text).Range("A1").PasteSpecial
Application.CutCopyMode = False
MsgBox cel.Text & " has been added"
Sheets(cel.Text).Range("B1").Value = cel.Text
End If
With Sheets(cel.Text)
Set rng = .Range("B2", .Cells(.Rows.Count, "B").End(xlUp))
myCell = rng.Find("Last", , xlValues, xlWhole, xlByRows, xlNext, False).Offset(-2, 0).Address
NR1 = .Range(myCell).End(xlUp).Row + 1
.Cells(NR1, "B").Resize(1, 5).Value = cel.Offset(0, 1).Resize(1, 5).Value
End With
Next cel
End With
End Sub
Function WorksheetExists(SheetName As String, _
Optional WhichBook As Workbook) As Boolean
'from Chip Pearson
Dim WB As Workbook
Set WB = IIf(WhichBook Is Nothing, ThisWorkbook, WhichBook)
On Error Resume Next
WorksheetExists = CBool(Len(WB.Worksheets(SheetName).Name) > 0)
End Function
I've not monkeyed with Cells B34 to G39 in the Individual Player Sheets...only you know what these are to do. Of course, try the Code n the Sample file and/or a COPY of your live file. Let me know of issues.
Bookmarks