View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Jack Sons Jack Sons is offline
external usenet poster
 
Posts: 144
Default ThisWorkbook of personal.xls

Hi all,

Hi all,

When I have in ThisWorkbook of personal.xls the code below without the last
sub (the Private Sub xlApp_SheetSelectionChange), all functions well.
But when the last sub is added I have problems with copying because when I
try to copy data, the items paste and past special of the right mouse click
menue are greyed out, the same with the paste buttons in the bar (don't know
its name) above in my screen. Also ctr c - ctr v does not work in the proper
way.

What causes this behaviour and how can I overcome it?

Jack Sons
The Netherlands
------------------------------------------------------------------------------------------------------------------
Option Explicit
Public WithEvents xlApp As Application
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Set xlApp = Nothing
End Sub

Private Sub Workbook_Open()
Set xlApp = Application
End Sub

Private Sub xlApp_SheetSelectionChange(ByVal Sh As Object, ByVal Target As
Range)
Application.DisplayStatusBar = True
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=" & Round(Application.sum(Target), 2) & "; " & _
"Max=" & Application.Max(Target) & "; " & _
"Min=" & Application.Min(Target)
End If
End Sub