-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStatus Bar
More file actions
167 lines (120 loc) · 3.88 KB
/
Status Bar
File metadata and controls
167 lines (120 loc) · 3.88 KB
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
162
163
164
165
166
Status Bar
Stored: PERESONNAL.xlsb
Description: This set of macros is used to send information about a file to the status bar.
- checkHidden - subroutine – returns the values of hidden columns and rows. if there are no hidden columns and rows, it returns “Nothing Hidden”
- autoFilterStatus - subroutine – returns the values of any columns that have the Auto Filter on.
- warningStatus – subroutine – returns the status of the Excel warnings.
- WhatColor – subroutine – returns the RGB value of the interior color of the selected cell.
- whatColumnNum – subroutine – returns the numerical value of the column of the selected column or cell.
- resetStatusBar – subroutine – reset the status bar.
Public sub checkHidden()
Dim lRow as Long
Dim lCol As Long
Dim cell As Range
Dim rowRng As Range
Dim colRng As Range
Dim rowResult As String
Dim colResult As String
lRow = Cells(Rows.Count, "A").End(xlUp).Row
lCol = Cells(1, columns.count).End(xlToLeft).Column
Set rowRng = Range("A1:A" & lRow)
For Each cell in rowRng
If cell.EntireRowHidden = True Then
rowResult = rowResult & cell.Row & ""
End if
Next Cell
Set colRng = Range(Cells(1,1), Cells(1, lCol))
For each cell in colRng
If cell.EntireColumn.Hidden = true then
ColResult = colResult & split(cell.address(true, false), "$" (0) & " "
End if
Next cell
statusOutput = ""
If rowResult <> "" Then
statusOutput = "Row: " & rowResult
End if
If colResult <> "" Then
statusOutput = "Columns: " & colResult
End if
If statusOutput = "" Then
Application.StatusBar = "Nothing is Hidden."
Else
Application.StatusBar = "Hidden on " & statusOutput
End if
End sub
Public sub autoFilterStatus()
Dim colFil As Long
Dim colFilter As String
Dim statusOutput As String
Dim autoFilter As AutoFilter
If ActiveSheet.AutoFilterMode = false Then
Application.StatusBar = False
Exit sub
End if
Set autoFilter = ActiveSheet.AutoFilter
For colFil =1 to autoFilter.filters.count
If autoFilter.filters(colFil).On Then
colFilter = autoFilter.Range.Cells(1, colFIl).value
statusOutput = statusOutput & " | " & colFilter
End if
Next colFil
If statusOutput = "" Then
Application.StatusBar = "Nothing is filtered."
Else
Application.StatusBar = "Filtered on " & statusOutput
End if
End sub
Public sub warningStatus()
Dim statusOutput As String
If application.DisplayAlerts = True then
statusOutput = "Display Alerts: Yes | "
ElseIf application.DisplayAlerts = False then
statusOutput = "Display Alerts: No | "
End if
If application.EnableEvents = True then
statusOutput = statusOutput & "Enable Events: Yes | "
ElseIf application.DisplayAlerts = False then
statusOutput = statusOutput & "Enable Events: No | "
End if
If application.ScreenUpdating = True then
statusOutput = statusOutput & "Screen Updating: Yes | "
ElseIf application.DisplayAlerts = False then
statusOutput = statusOutput & "ScreenUpdating: No | "
End if
Application.StatusBar = "Are they on?" & statusOutput
End sub
Public Sub WhatColor()
Dim statusOutput As String
Dim actRng As Range
Dim redLevel As integer
Dim greenLevel As integer
Dim blueLevel As integer
Set actRng = ActiveCell
With actRng.Interior
redLevel = .Color Mod 256
greenLevel = (.Color Mod 256^ 2)\256
blueLevel = .Color \ (256 ^ 2)
End With
statusOutput = "(" & redLevel & ", " & greenLevel & ", " blueLevel & ")"
If statusOutput = "" Then
Application.statusBar = "There is no color."
ElseIf application.DisplayAlerts = False then
Application.statusBar = "The RGB value " & statusOutput
End if
End sub
Public Sub whatColumnNum()
Dim statusOutput As String
Dim colRng As Range
Dim colNum As Long
Set colRng = ActiveCell
colNum = colRng.Column
statusOutput = "Column number: " & colNum
If statusOutput = "" Then
Application.StatusBar = "No column selected."
Else
Application.StatusBar = statusOutput
End If
End Sub
Public sub resetStatusBar()
Application.statusBar = false
End sub