Hi,
Let me explain what I am trying to do.
I have a 2 sheet workbook Sheet1 = (Data) is a pivot table ,Sheet2(Saved)
I am trying to create a macro that works with my pivot table. The problem is when I record my macro I start on sheet1 to double click the value in cell B3 it automatically opens up sheet3( sheet3 is all of the person work for that day) So I want to insert 3 lines and count or sum all the cells in the ranges A3:A500 for coulmns A,B,C,D and E .I then want to copy all the calculations just made (sheet3 cells A1:A5) then paste special the values to sheet2(saved) then Delete sheet3 and return to sheet1 to start all over again at B4 and so on till it hits an empty cell on sheet1 (data).
Can someone help me with this code:
Thank You So Much...
Sub Macro6()
Dim cell As Range
Dim wks As Worksheet
For Each cell In Worksheets("data").Range("B3", Range("B3").End(xlDown))
cell.ShowDetail = True
Set wks = Worksheets.Add
Rows("1:3").Select
Selection.Insert Shift:=xlDown
Range("A1").FormulaR1C1 = "=R[4]C"
Range("C1").FormulaR1C1 = "=COUNT(R[4]C:R[499]C)"
Range("D1:F1").FormulaR1C1 = "=SUM(R[4]C:R[499]C)"
Range("A1:F1").Copy
Sheets("New Totals").Range("A3").PasteSpecial Paste:=xlPasteValues
Application.DisplayAlerts = False
wks.Delete
Application.DisplayAlerts = True
Next cell
End Sub
Bookmarks