Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Workbook_SheetActivate Paste Problem

I have a workbook with 16 pivot tables on 16 worksheets. My problem is
that I cannot copy and paste data between worksheets while I have the
following Workbook_SheetActivate event active. No error message is
generated, just the paste function is disabled. Removing the event
solves the problem, but I need to figure out what in the event is
causing the problem.

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If CheckPivotTableExists(ThisWorkbook.ActiveSheet) = True Then
Dim strReportType As String, strReportPeriod As String,
arrShName As Variant
Application.ScreenUpdating = False
arrShName = Split(Sh.Name, "-")
strReportType = Trim(arrShName(0))
If UBound(arrShName) = 1 Then
strReportPeriod = Trim(arrShName(1))
End If
SetActiveButton arrReportType, strReportType
SetActiveButton arrReportPeriod, strReportPeriod
blnDisplayFullScreen = GetPivotSetting("DisplayFullScreen")
If blnDisplayFullScreen = True Then
ActiveWindow.DisplayHeadings = False
ElseIf blnDisplayFullScreen = False Then
ActiveWindow.DisplayHeadings = True
End If

'set up wrap text on legends on 2nd line.
Dim pt As PivotTable, objTopLeft As Range, objBottomRight As Range
Set pt = Sh.PivotTables.Item(1)
Set objTopLeft = pt.ColumnRange.Cells(1, 1).Offset(1, 0)
Set objBottomRight = pt.ColumnRange.Cells(1, 1).Offset(1,
0).End(xlToRight)
Range(objTopLeft, objBottomRight).WrapText = True


Sh.Cells(1.1).Select
Application.ScreenUpdating = True
End If
End Sub

Thanks,
Wayne C.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Workbook_SheetActivate Paste Problem

Lots of things in code can cause the clipboard to be killed.

Maybe you can sprinkle lines like:

debug.print "Step 1: " & application.cutcopymode

through out the code. Then when you narrow down the portion, put one of those
debug.print lines after each line of your code.

Wayne Cressman wrote:

I have a workbook with 16 pivot tables on 16 worksheets. My problem is
that I cannot copy and paste data between worksheets while I have the
following Workbook_SheetActivate event active. No error message is
generated, just the paste function is disabled. Removing the event
solves the problem, but I need to figure out what in the event is
causing the problem.

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If CheckPivotTableExists(ThisWorkbook.ActiveSheet) = True Then
Dim strReportType As String, strReportPeriod As String,
arrShName As Variant
Application.ScreenUpdating = False
arrShName = Split(Sh.Name, "-")
strReportType = Trim(arrShName(0))
If UBound(arrShName) = 1 Then
strReportPeriod = Trim(arrShName(1))
End If
SetActiveButton arrReportType, strReportType
SetActiveButton arrReportPeriod, strReportPeriod
blnDisplayFullScreen = GetPivotSetting("DisplayFullScreen")
If blnDisplayFullScreen = True Then
ActiveWindow.DisplayHeadings = False
ElseIf blnDisplayFullScreen = False Then
ActiveWindow.DisplayHeadings = True
End If

'set up wrap text on legends on 2nd line.
Dim pt As PivotTable, objTopLeft As Range, objBottomRight As Range
Set pt = Sh.PivotTables.Item(1)
Set objTopLeft = pt.ColumnRange.Cells(1, 1).Offset(1, 0)
Set objBottomRight = pt.ColumnRange.Cells(1, 1).Offset(1,
0).End(xlToRight)
Range(objTopLeft, objBottomRight).WrapText = True

Sh.Cells(1.1).Select
Application.ScreenUpdating = True
End If
End Sub

Thanks,
Wayne C.


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Paste Problem Between Ex 97 vs 2k DaveM Excel Discussion (Misc queries) 5 January 30th 08 02:31 PM
Paste problem Pietro Excel Discussion (Misc queries) 2 October 13th 07 06:14 PM
Paste problem horst Excel Discussion (Misc queries) 3 October 3rd 06 05:30 PM
Paste Problem Ed Excel Discussion (Misc queries) 1 January 5th 06 10:42 AM
Excel cut/Paste Problem: Year changes after data is copy and paste Asif Excel Discussion (Misc queries) 2 December 9th 05 05:16 PM


All times are GMT +1. The time now is 07:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"