• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Keep spacing between Pivots

Gman

Member
Hello all I am beginning to make a dashboard but have run into an issue. I will have multiple pivot tables, and they will change in size as the month goes on. I want to keep the spacing between them the same at all times. I also need it to update the spacing automatically so when data for a new day gets added it shows that day and keeps the 3 spaces (rows 15,16,17) before next pivot starts.

Thanks in advance for the help.
Gman
 

Attachments

  • example.xlsx
    18.7 KB · Views: 2
Put this in to a vba sub :-

Code:
Const blanks =3
Dim lastValue AsString, i AsLong, r AsLong
Do
r = r +1
If r >1 And lastValue <> Cells(r,1).Value Then
If Cells(r,1).Value = "" ThenExitDo
For i =1 To blanks
Rows(r).Insert Shift:=xlDown
Next
r = r + blanks
EndIf
lastValue = Cells(r,1).Value
Loop
 
Put this in to a vba sub :-

Code:
Const blanks =3
Dim lastValue AsString, i AsLong, r AsLong
Do
r = r +1
If r >1 And lastValue <> Cells(r,1).Value Then
If Cells(r,1).Value = "" ThenExitDo
For i =1 To blanks
Rows(r).Insert Shift:=xlDown
Next
r = r + blanks
EndIf
lastValue = Cells(r,1).Value
Loop

I have tried the code you provided, unfortunately when I tried to run it gave me a "Run-time error '1004': We can't make this change for the selected cells because it will affect a PivotTable. Use the field list to change the report. If you are trying to insert or delete cells, move the PivotTable and try again."
 
Back
Top