Hi Fred
Just a few minor changes...
Sub NewUser()
Dim ws As Worksheet
Dim x As Long
Dim c As Long
Dim d As Long
Set ws = ActiveWorkbook.Sheets("MASTER")
ActiveSheet.Unprotect "PFP1972!" 'Type your password here
With ws
d = .Columns("C:C").Find("INITIALS", , xlValues, xlPart, xlByRows, xlNext, False).Row
If .Cells(d, "D").Value = "" Then
MsgBox "Enter the New User Information"
ActiveSheet.Protect "PFP1972!" 'Type your password here
Exit Sub
End If
Application.ScreenUpdating = False
x = .Cells.Find(What:="*", After:=[A1], SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious).Column
' x = .UsedRange.Columns.Count
.Range(.Cells(2, "B"), .Cells(2, x)).UnMerge
.Range(.Cells(7, 2), .Cells(7, x)).UnMerge
c = .Columns("B:C").Find("WEEK TOTALS:", , xlValues, xlPart, xlByRows, xlNext, False).Row - 1
.Range(.Cells(c, 2), .Cells(c, x)).UnMerge
.Columns(x - 1).Copy
.Columns(x - 1).Insert Shift:=xlToRight
Application.CutCopyMode = False
.Cells(6, x) = Range("$D$" & d)
End With
Sheets("Template").Visible = True
Application.DisplayAlerts = False
ActiveWorkbook.Sheets("Template").Copy After:=Sheets(ThisWorkbook.Sheets.Count)
With ActiveSheet
.Name = ws.Range("D" & d).Value
.Cells(1, "B").Value = ws.Range("D" & d + 1).Value
.Cells(2, "B").Value = ws.Range("D" & d + 2).Value
End With
Sheets("Template").Visible = False
Application.DisplayAlerts = True
With ws
.Range("D" & c & ":D" & d + 2).ClearContents
.Range(.Cells(2, "B"), .Cells(2, x + 1)).Merge
.Range(.Cells(7, 2), .Cells(7, x + 1)).Merge
.Range(.Cells(c, 7), .Cells(c, x + 1)).Merge
.Activate
End With
Application.ScreenUpdating = True
ActiveSheet.Protect "PFP1972!" 'Type your password here
End Sub
Bookmarks