-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCleanup.bas
161 lines (135 loc) · 4.7 KB
/
Cleanup.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
Attribute VB_Name = "Cleanup"
Sub Everything_ASPNET()
Call EverythingCommonToAll
Call RemoveText_ASPNET
Call ShortenLongColumns_ASPNET
Call HideColumns_ASPNET
End Sub
Sub EveryThing_DOTNET()
Call EverythingCommonToAll
Call RemoveText_DOTNET
Call ShortenLongColumns_DOTNET
Call HideColumns_DOTNET
End Sub
Sub Everything_EF()
Call EverythingCommonToAll
Call RemoveText_EF
Call HideColumns_ASPNET
End Sub
Sub EverythingCommonToAll()
Call DeleteTop2RowsIf
Call PinTopRow
Call RemoveSumOf
Call ShortenLongColumnNames
Call WidenColumns
Call MakeHyperLinkColumn
Call ScrollToBeginning
End Sub
Sub DeleteTop2RowsIf()
Set rRng = Sheet1.Range("A2")
' If row 2 is empty, remove the top two rows.
' Row 1 shows the selected filters, row 2 is blank.
If IsEmpty(rRng.Value) Then
Rows("1:1").Select
Selection.Delete Shift:=xlUp
Selection.Delete Shift:=xlUp
End If
End Sub
Sub PinTopRow()
Set rRng = Sheet1.Range("A2")
If IsEmpty(rRng.Value) Then
Rows("1:1").Select
Selection.Delete Shift:=xlUp
Selection.Delete Shift:=xlUp
End If
ActiveWindow.SplitRow = 1
ActiveWindow.FreezePanes = True
End Sub
Sub RemoveSumOf()
Rows("1:1").Select
Range("Table1[[#Headers],[Title]]").Activate
Selection.Replace What:="Sum of ", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
End Sub
Sub ShortenLongColumnNames()
Rows("1:1").Select
Range("Table1[[#Headers],[Title]]").Activate
Selection.Replace What:="BounceRate", Replacement:="Bounce", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
Rows("1:1").Select
Range("Table1[[#Headers],[Title]]").Activate
Selection.Replace What:="CSATHelpfulRate", Replacement:="CSAT", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
End Sub
Sub WidenColumns()
Columns("B:B").ColumnWidth = 50 ' Title
Columns("D:F").EntireColumn.AutoFit ' Page views, PV MoM, Visitors
Columns("L:M").EntireColumn.AutoFit ' Bounce rate, Exit rate
Columns("X:X").EntireColumn.AutoFit ' CSAT rate
End Sub
Sub ScrollToBeginning()
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollRow = 1
End Sub
Sub HideColumns_ASPNET()
Columns("A").Hidden = True ' Topic type
Columns("C").Hidden = True ' Live URL
Columns("G").Hidden = True ' Search referrals
Columns("H:K").Hidden = True 'KPI rank, KPI rank change, CTR, CopyTryScroll
Columns("N:W").Hidden = True ' Organic search through Dwell rate
Columns("Y:AO").Hidden = True ' CSAT response rate through end
End Sub
Sub RemoveText_ASPNET()
' Remove "in ASP.NET Core"
Range("Table1[[#Headers],[Title]]").Select
Cells.Replace What:=" in ASP.NET Core", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
End Sub
Sub RemoveText_EF()
' Remove " - EF Core"
Range("Table1[[#Headers],[Title]]").Select
Cells.Replace What:=" - EF Core", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
End Sub
Sub ShortenLongColumns_ASPNET()
Range("Table1[[#Headers],[Title]]").Select
Cells.Replace What:="Secure an ASP.NET Core", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
End Sub
Sub HideColumns_DOTNET()
Columns("A").Hidden = True ' Topic type
Columns("C").Hidden = True ' Live URL
`Columns("E").Hidden = True ' PV MoM
Columns("G").Hidden = True ' Search referrals
Columns("N").Hidden = True ' Organic search
Columns("N:W").Hidden = True ' Organic search through Dwell rate
Columns("Y:Z").Hidden = True ' CSAT response rate, CSAT helpful responses
Columns("AB:AO").Hidden = True ' CSAT rating verbatims through end
End Sub
Sub RemoveText_DOTNET()
' Nothing to remove at this time.
End Sub
Sub ShortenLongColumns_DOTNET()
' Nothing to shorten at this time.
End Sub
Sub MakeHyperLinkColumn()
Call MakeHyperLinks
Call HyperLinkColumnName
End Sub
Sub MakeHyperLinks()
Range("AP2").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=HYPERLINK([@LiveUrl])"
Range("AP3").Select
End Sub
Sub HyperLinkColumnName()
Range("Table1[[#Headers],[Column1]]").Select
ActiveCell.FormulaR1C1 = "Link"
Range("AP2").Select
End Sub