Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Error on paste

This code has worked in the past for copying an oval shape with a clear background from one sheet to another. (we use it to circle info we wish to draw attention to). But it recently began to error at Activesheet.Paste. Any thoughts on why that might be? Or a way to fix, or do differently? Thanks in advance, Paul

Private Sub CommandButton2_Click()
Application.ScreenUpdating = False
Sheets("Sheet2").Select
ActiveSheet.Shapes("Oval 2").Select
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.unprotect
ActiveSheet.Paste
Selection.ShapeRange.IncrementLeft -12.75
Selection.ShapeRange.IncrementTop -30.25
Sheets("Sheet1").Select
ActiveCell.Offset(0, 4).Range("A1").Select
Sheets("Sheet1").Select
ActiveSheet.protect DrawingObjects:=False, Contents:=True, Scenarios:=True
Application.ScreenUpdating = True
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Error on paste

Hi Paul,

Am Wed, 27 Jul 2016 10:59:29 -0700 (PDT) schrieb Paul Doucette:

This code has worked in the past for copying an oval shape with a clear background from one sheet to another. (we use it to circle info we wish to draw attention to). But it recently began to error at Activesheet.Paste. Any thoughts on why that might be? Or a way to fix, or do differently? Thanks in advance, Paul


try:
Private Sub CommandButton2_Click()
Application.ScreenUpdating = False

Sheets("Sheet2").Shapes("Oval 2").Copy

With Sheets("Sheet1")
.Unprotect
.Paste
With .Shapes("Oval 2")
.IncrementLeft -12.75
.IncrementTop -30.25
End With
.Protect DrawingObjects:=False, Contents:=True, Scenarios:=True
End With
Application.ScreenUpdating = True
End Sub


Regards
Claus B.
--
Windows10
Office 2016
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Error on paste

On Wednesday, July 27, 2016 at 1:59:49 PM UTC-4, Paul Doucette wrote:
This code has worked in the past for copying an oval shape with a clear background from one sheet to another. (we use it to circle info we wish to draw attention to). But it recently began to error at Activesheet.Paste. Any thoughts on why that might be? Or a way to fix, or do differently? Thanks in advance, Paul

Private Sub CommandButton2_Click()
Application.ScreenUpdating = False
Sheets("Sheet2").Select
ActiveSheet.Shapes("Oval 2").Select
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.unprotect
ActiveSheet.Paste
Selection.ShapeRange.IncrementLeft -12.75
Selection.ShapeRange.IncrementTop -30.25
Sheets("Sheet1").Select
ActiveCell.Offset(0, 4).Range("A1").Select
Sheets("Sheet1").Select
ActiveSheet.protect DrawingObjects:=False, Contents:=True, Scenarios:=True
Application.ScreenUpdating = True
End Sub


Still hanging up at .Paste
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Error on paste

Hi Paul,

Am Wed, 27 Jul 2016 11:39:49 -0700 (PDT) schrieb Paul Doucette:

Still hanging up at .Paste


in my workbook it is working fine.
Try:

Private Sub CommandButton2_Click()
Application.ScreenUpdating = False

Sheets("Sheet2").Shapes("Oval 2").Copy
Sheets("Sheet1").Paste

With Sheets("Sheet1")
With .Shapes("Oval 2")
.IncrementLeft -12.75
.IncrementTop -30.25
End With
End With
Application.ScreenUpdating = True
End Sub


Regards
Claus B.
--
Windows10
Office 2016
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default Error on paste

On Wednesday, July 27, 2016 at 1:59:49 PM UTC-4, Paul Doucette wrote:
This code has worked in the past for copying an oval shape with a clear background from one sheet to another. (we use it to circle info we wish to draw attention to). But it recently began to error at Activesheet.Paste. Any thoughts on why that might be? Or a way to fix, or do differently? Thanks in advance, Paul

Private Sub CommandButton2_Click()
Application.ScreenUpdating = False
Sheets("Sheet2").Select
ActiveSheet.Shapes("Oval 2").Select
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.unprotect
ActiveSheet.Paste
Selection.ShapeRange.IncrementLeft -12.75
Selection.ShapeRange.IncrementTop -30.25
Sheets("Sheet1").Select
ActiveCell.Offset(0, 4).Range("A1").Select
Sheets("Sheet1").Select
ActiveSheet.protect DrawingObjects:=False, Contents:=True, Scenarios:=True
Application.ScreenUpdating = True
End Sub


Just tried on a different machine, and it works fine there too. I'm thinking my server needs a restart.
Sorry for bothering you, and thanks very much for pointing me in the right direction!
-Paul


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,182
Default Error on paste

This code has worked in the past for copying an oval shape with a
clear background from one sheet to another. (we use it to circle info
we wish to draw attention to). But it recently began to error at
Activesheet.Paste. Any thoughts on why that might be? Or a way to
fix, or do differently? Thanks in advance, Paul

Private Sub CommandButton2_Click()
Application.ScreenUpdating = False
Sheets("Sheet2").Select
ActiveSheet.Shapes("Oval 2").Select
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.unprotect
ActiveSheet.Paste
Selection.ShapeRange.IncrementLeft -12.75
Selection.ShapeRange.IncrementTop -30.25
Sheets("Sheet1").Select
ActiveCell.Offset(0, 4).Range("A1").Select
Sheets("Sheet1").Select
ActiveSheet.protect DrawingObjects:=False, Contents:=True,
Scenarios:=True Application.ScreenUpdating = True
End Sub


Why not just draw a new shape when/as needed?

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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 error Alan[_9_] Excel Discussion (Misc queries) 0 December 17th 07 05:43 PM
Error when doing a paste Backslider Excel Programming 3 October 3rd 06 08:41 PM
Cut and Paste using Macro gives paste special method error Lourens Pentz Excel Programming 3 November 21st 04 11:42 PM
Code Error - Run Time Error 5 (Disable Cut, Copy & Paste) Tim[_36_] Excel Programming 4 April 23rd 04 02:53 AM
Paste Error Marishah Warren Excel Programming 1 December 17th 03 09:31 AM


All times are GMT +1. The time now is 08:33 AM.

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

About Us

"It's about Microsoft Excel"