Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default copy-paste error

Ryan,

Try changing your Activate to a Select:

Worksheets("Sheet1").Cells(Rows.Count, 1).End(xlUp) _
.Offset(1, 0).Activate

to

Worksheets("Sheet1").Cells(Rows.Count, 1).End(xlUp) _
.Offset(1, 0).Select

Activate doesn't modify the current selection if the cell being activated is
within the selection, which could lead to a paste error due to incompatible
range sizes.

HTH,
Bernie
MS Excel MVP

"Ryan" wrote in message
...
I'm trying to copy a range of data from sheet A and paste it into Sheet B,

then i'm trying to copy a range of data from a sheet C and paste it into the
next empty cell in Sheet B. so the data from C should paste right under the
data from A.

I'm getting an compiler error for the activesheet.paste statement at the

bottom.

can anyone tell me what is wrong.

tks.

Sub CollectData1()

Workbooks.Open Filename:= _
"G:\Credit\CSCASHSUM_VBA_V1.xls"
Sheets("CT").Select
Application.Goto Reference:="R1C1"
Range("A1").Select
Selection.CurrentRegion.Select
Selection.Copy
Windows("CS-Summary-Report.xls").Activate
Range("A2").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,

SkipBlanks:= _
False, Transpose:=False
Rows("2:2").Select
Selection.Font.Bold = True
With Selection.Interior
.ColorIndex = 36
.Pattern = xlSolid
End With
Cells.Select
Selection.Columns.AutoFit

Workbooks.Open Filename:= _
"G:\Credit\ComSwapsVBA.xls" _
, UpdateLinks:=0
Sheets("UNIQUE2").Select
Range("A1").Select
Selection.CurrentRegion.Select
Selection.Copy
Windows("CS-Summary-Report.xls").Activate

Worksheets("Sheet1").Cells(Rows.Count, 1).End(xlUp) _
.Offset(1, 0).Activate

ActiveSheet.Paste

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
Copy paste error ganeson r Charts and Charting in Excel 1 December 13th 09 08:25 AM
copy and paste error jenny Excel Discussion (Misc queries) 2 January 16th 09 01:53 PM
Copy/Paste error Anthony Excel Worksheet Functions 2 February 7th 07 06:46 PM
Code Error - Run Time Error 5 (Disable Cut, Copy & Paste) Tim[_36_] Excel Programming 4 April 23rd 04 02:53 AM
Error in Copy/Paste Thierry zen Ruffinen Excel Programming 0 April 5th 04 09:46 AM


All times are GMT +1. The time now is 03:04 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"