The pivottables vary in size each week, so I have to clear the area before pasting the new tables in.
Instead of using a macro to delete all sorts of borders and colors etc. such as the one deleteformat code on bottom. I just copy A1 (empty cell) and paste it to the area, to overwrite all borders, colors etc.
But how come
swb.Worksheets("1").Range("B4:Q38").Paste
-Doesn't work, when
swb.Worksheets("1").Range("B4").PasteSpecial xlPasteAll
works?
Sub DeleteFormat()
Application.ScreenUpdating = False
'Delete content in cells
Selection.ClearContents
'Delete any border
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
'Delete any color inside cells
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
'Delete any fontcolor
With Selection.Font
.ColorIndex = xlAutomatic
.TintAndShade = 0
End With
Application.ScreenUpdating = True
End Sub
Bookmarks