I have a sheet of raw data with the average located at the bottom, I want to run through every column on a summary sheet, and place the average given on the raw data sheet below. what I have:
On Error Resume Next
Application.DisplayAlerts = False
Sheets.Add After:=Worksheets("Raw PivotTable")
ActiveSheet.Name = "Summary"
Application.DisplayAlerts = True
Set SSheet = Worksheets("Summary")
Set RSheet = Worksheets("Raw PivotTable")
Set PSheet = Worksheets("PivotTable")
Dim C As Integer
Dim PSheetVal As Long
C = 2
RSheet.Range("B1:" & ActiveSheet.Range(Cells(1, Columns.Count).End(xlToRight).Address).End(xlUp).Address).Copy
ActiveSheet.Paste Destination:=SSheet.Range("A1")
For Each cell In SSheet.Range("A1:" & SSheet.Range("A1").End(xlToRight).Address)
PSheetVal = PSheet.Range(Cells(2, C)).End(xlDown).Value
' ^^^^ this is causing my issues specifically.
cell.Offset(1, 0).Value = PSheetVal
C = C + 1
Next
For me it is putting 0s instead of the actual values.