ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Status Bar (https://www.excelbanter.com/excel-programming/409030-status-bar.html)

Alan

Status Bar
 
Just got this code from one of the other groups. It displays all of the
options like Sum, Average etc available on the Status Bar at the same time.
A really useful thing to have in the Personal Macro's. I don't know who
wrote it, certainly not me! I'm just passing it on, I take off my hat to
whoever it was,
Regards,
Alan.

Option Explicit
Public WithEvents xlApp As Application

Private Sub Workbook_Open()
Set xlApp = Application
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Set xlApp = Nothing
Application.DisplayStatusBar = True
End Sub

Private Sub xlApp_SheetSelectionChange(ByVal Sh As Object, ByVal Target As
Range)
On Error Resume Next
If Target.Count < 2 Then
Application.StatusBar = False
Else
Application.StatusBar = _
"Average=" & Round(Application.Average(Target), 2) _
& "; " & "Count=" & Application.CountA(Target) & _
"; " & "Count nums=" & Application.Count(Target) & _
"; " & "Sum=" & Format(Round(Application.Sum(Target), 2), _
"#,##0.00") & "; " & "Max=" & Application.Max(Target) & "; " _
& "Min=" & Application.Min(Target)
End If
End Sub


Peter T

Status Bar
 
Looks like something adapted from one of my posts in this ng

http://groups.google.co.uk/group/mic...f4abf75d78758f

Regards,
Peter T

"Alan" wrote in message
...
Just got this code from one of the other groups. It displays all of the
options like Sum, Average etc available on the Status Bar at the same

time.
A really useful thing to have in the Personal Macro's. I don't know who
wrote it, certainly not me! I'm just passing it on, I take off my hat to
whoever it was,
Regards,
Alan.

Option Explicit
Public WithEvents xlApp As Application

Private Sub Workbook_Open()
Set xlApp = Application
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Set xlApp = Nothing
Application.DisplayStatusBar = True
End Sub

Private Sub xlApp_SheetSelectionChange(ByVal Sh As Object, ByVal Target As
Range)
On Error Resume Next
If Target.Count < 2 Then
Application.StatusBar = False
Else
Application.StatusBar = _
"Average=" & Round(Application.Average(Target), 2) _
& "; " & "Count=" & Application.CountA(Target) & _
"; " & "Count nums=" & Application.Count(Target) & _
"; " & "Sum=" & Format(Round(Application.Sum(Target), 2), _
"#,##0.00") & "; " & "Max=" & Application.Max(Target) & "; " _
& "Min=" & Application.Min(Target)
End If
End Sub




Alan

Status Bar
 
In that case, thank you. This is one of the most useful things I've seen in
a long time,
Regards,
Alan.
"Peter T" <peter_t@discussions wrote in message
...
Looks like something adapted from one of my posts in this ng

http://groups.google.co.uk/group/mic...f4abf75d78758f

Regards,
Peter T

"Alan" wrote in message
...
Just got this code from one of the other groups. It displays all of the
options like Sum, Average etc available on the Status Bar at the same

time.
A really useful thing to have in the Personal Macro's. I don't know who
wrote it, certainly not me! I'm just passing it on, I take off my hat to
whoever it was,
Regards,
Alan.

Option Explicit
Public WithEvents xlApp As Application

Private Sub Workbook_Open()
Set xlApp = Application
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Set xlApp = Nothing
Application.DisplayStatusBar = True
End Sub

Private Sub xlApp_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As
Range)
On Error Resume Next
If Target.Count < 2 Then
Application.StatusBar = False
Else
Application.StatusBar = _
"Average=" & Round(Application.Average(Target), 2) _
& "; " & "Count=" & Application.CountA(Target) & _
"; " & "Count nums=" & Application.Count(Target) & _
"; " & "Sum=" & Format(Round(Application.Sum(Target), 2), _
"#,##0.00") & "; " & "Max=" & Application.Max(Target) & "; " _
& "Min=" & Application.Min(Target)
End If
End Sub






All times are GMT +1. The time now is 10:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com