Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Copying & Pasting

Hi Guys,

I posted this yesterday and it worked the great the first
time i tried it, but since then an error stops it at the
second paste operation ?. Does anybody know why this is
happening ?


Private Sub CommandButton6_Click()
ActiveSheet.Cells.Copy
Sheets("Cashflow Chart Sheet").Select
With ActiveSheet
.Range("A1").PasteSpecial Paste:=xlAll,
Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
With ActiveSheet
ActiveSheet.Cells.Copy
.Range("A1").PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
.Range("A2:I7").Clear
.Range("A29:I29").ClearContents
.Range("D13").ClearContents
.Range("A1").Select
End With
End With
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Copying & Pasting

Michael,

Your code "works" for me (Excel 2002), that is it doesn't crasch.

However, I don't understand what you are trying to do; here's what happens:

* all cells on the active sheet are copied
* sheet 'Cashflow Chart Sheet' is selected and overwritten with the copied data
* all cells on sheet 'Cashflow Chart Sheet' (that were just pasted) are copied
and pasted back into the same location (??)
* some rows are cleared

Also note that there are two nested With ActiveSheet blocks, operating on the
same sheet, which has no point.

Regards
Anders Silvén

"Michael" skrev i meddelandet
...
Hi Guys,

I posted this yesterday and it worked the great the first
time i tried it, but since then an error stops it at the
second paste operation ?. Does anybody know why this is
happening ?


Private Sub CommandButton6_Click()
ActiveSheet.Cells.Copy
Sheets("Cashflow Chart Sheet").Select
With ActiveSheet
.Range("A1").PasteSpecial Paste:=xlAll,
Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
With ActiveSheet
ActiveSheet.Cells.Copy
.Range("A1").PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
.Range("A2:I7").Clear
.Range("A29:I29").ClearContents
.Range("D13").ClearContents
.Range("A1").Select
End With
End With
End Sub



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
Copying and Pasting Minnie Excel Discussion (Misc queries) 10 December 11th 08 02:53 PM
Copying and Pasting Kokomo Excel Discussion (Misc queries) 1 November 20th 07 02:14 PM
Copying and Pasting davew21 Excel Discussion (Misc queries) 1 March 31st 06 03:40 PM
Copying and Pasting Tia Excel Discussion (Misc queries) 4 June 6th 05 08:54 PM
help...too much copying and pasting rahulb Excel Programming 1 August 19th 03 04:19 AM


All times are GMT +1. The time now is 11:03 AM.

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"