Sub Demo1r()
Const F = "B6:B#&C6:C#&"" - ""&D6:D#&"" ""&E6:E#&"" ""&F6:F#&"" (""&G6:G#&"") - ""&H6:H#&"" HR"""
With Application
V = .Index([A1:P1], 1, [{1,3,6,8,9,14,10,16}])
.ScreenUpdating = False
If Worksheets.Count > Index Then
.DisplayAlerts = False
Worksheets(Evaluate("TRANSPOSE(ROW(" & Index + 1 & ":" & Worksheets.Count & "))")).Delete
.DisplayAlerts = True
End If
UsedRange.Columns(4).AdvancedFilter 2, , [AF1], True
[AF1].CurrentRegion.Sort [AF1], 2, Header:=1
For Each W In Range("AF2", [AF1].End(xlDown)).Value
[AF2] = W
With Sheets.Add(, Me)
.Name = W
.[B5:I5] = V
[A1].CurrentRegion.AdvancedFilter 2, [AF1:AF2], .[B5:I5]
With .[A5].CurrentRegion.Columns
.Item(5).Replace "INFINITY SIGNATURE MASSAGE", "INF", 2
.Item(5).Replace "INFINITY", "INF", 2
.Item(5).Replace "FOOT REFLEX", "FOOT", 2
.Item(6).Replace "SPA SIESTA", "SS", 2
.Item(9).Font.Name = .Cells(9).Font.Name
.Item(9).Interior.ColorIndex = xlNone
.Offset(1).Font.Size = 12
.Rows(-2).HorizontalAlignment = 7
R = .Rows(.Rows.Count).Row
X = Application.Sum(.Item(8))
End With
.[A2].Font.Size = 16
.[A2] = W
.[A5,I5].Font.Underline = 2
.[A5] = "PARTICULARS"
.[I5].HorizontalAlignment = xlCenter
.[I5] = "AMOUNT"
.Range("B6:B" & R) = Application.Text(.Range("B6:B" & R), "mmm-dd-yy ddd: ")
.Range("A6:A" & R) = .Evaluate(Replace(F, "#", R))
.Range("I6:I" & R - (R > 6)).HorizontalAlignment = 1
.Range("I6:I" & R - (R > 6)).NumberFormat = "# ###_W"
If R > 6 Then
With .Rows(R + 1).Columns("A:I")
.Font.Color = vbRed
.Formula = Array("TOTAL", , X, IIf(X > 1, "HRS", "HR"), , , , , "=SUM(I6:I" & R & ")")
End With
End If
.Range("B5:H" & R).Clear
End With
Next
[AF1].CurrentRegion.Clear
.ScreenUpdating = True
End With
End Sub