So I have the following code....I am fairly novice so I am not sure this is even the most effective way to do this
Sub BuildTable()
Application.ScreenUpdating = False
Dim copySheet AsWorksheet
Dim pasteSheet AsWorksheet
Dim LastRow As Long
Set copySheet =Worksheets("Combined Data")
Set pasteSheet =Worksheets("Pivot Tables")
LastRow =Worksheets("Pivot Tables").Range("B" & Rows.Count).End(xlUp).Row+ 2
Worksheets("Pivot Tables").Range("B" & LastRow)= 1
Worksheets("Pivot Tables").Range("B" &LastRow).Select
Selection.DataSeriesRowcol:=xlRows, Type:=xlLinear, Date:=xlDay, _
Step:=1,Stop:=12, Trend:=False
copySheet.Range("I3:I5000").Copy
pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(3, 0).PasteSpecialxlPasteValues
pasteSheet.Range("A" & Cells(Rows.Count, 1).End(xlUp).Row+ 1).RemoveDuplicates Columns:=1, Header:=xlNo
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
What this is doing is creating a "table" which uses unique values pulled from a column of a data table to create the "y" axis in column A, and the numbers 1-12 for the "x" axis one row above and one column over from were the "y" starts. Both of these move in relation to last row, because pivot tables populate the top half of this worksheet, and can adjust in size, and this table places itself below them.
Here is what I can't get to work. I need to fill in the area created by the variable y axis, and the static 1-12 in the x axis, with a formula. I have been able to get this to work based on cell references, but I can't figure out how to get it to adjust in relation to the y axis. I am not married to the existing code if there is a better way. Any help would be appreciated, thank you in advance.
Sub BuildTable()
Application.ScreenUpdating = False
Dim copySheet AsWorksheet
Dim pasteSheet AsWorksheet
Dim LastRow As Long
Set copySheet =Worksheets("Combined Data")
Set pasteSheet =Worksheets("Pivot Tables")
LastRow =Worksheets("Pivot Tables").Range("B" & Rows.Count).End(xlUp).Row+ 2
Worksheets("Pivot Tables").Range("B" & LastRow)= 1
Worksheets("Pivot Tables").Range("B" &LastRow).Select
Selection.DataSeriesRowcol:=xlRows, Type:=xlLinear, Date:=xlDay, _
Step:=1,Stop:=12, Trend:=False
copySheet.Range("I3:I5000").Copy
pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(3, 0).PasteSpecialxlPasteValues
pasteSheet.Range("A" & Cells(Rows.Count, 1).End(xlUp).Row+ 1).RemoveDuplicates Columns:=1, Header:=xlNo
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
What this is doing is creating a "table" which uses unique values pulled from a column of a data table to create the "y" axis in column A, and the numbers 1-12 for the "x" axis one row above and one column over from were the "y" starts. Both of these move in relation to last row, because pivot tables populate the top half of this worksheet, and can adjust in size, and this table places itself below them.
Here is what I can't get to work. I need to fill in the area created by the variable y axis, and the static 1-12 in the x axis, with a formula. I have been able to get this to work based on cell references, but I can't figure out how to get it to adjust in relation to the y axis. I am not married to the existing code if there is a better way. Any help would be appreciated, thank you in advance.