ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pasting Error (https://www.excelbanter.com/excel-programming/350652-pasting-error.html)

halem2[_55_]

Pasting Error
 

hI:

I'm getting an error with this code because Copy Area and Paste Area
are not same size. The Copy Area is the same column but I never know
how many cells it is going to have. The Paste Area is right below the
last cell that contains data in a different column. Any help is
welcome.

'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''
Range("DS5").Select
Range(ActiveCell, ActiveCell.End(xlDown)).Select
Selection.Copy
'
Range("A5").Select
Do
If ActiveCell.Select < "" Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until ActiveCell = ""
'
ActiveSheet.Paste


thanks :confused:


--
halem2
------------------------------------------------------------------------
halem2's Profile: http://www.excelforum.com/member.php...fo&userid=9930
View this thread: http://www.excelforum.com/showthread...hreadid=502069


Toppers

Pasting Error
 
Hi,
Try thiS;

' find next blank row in column A
nextrow = Cells(Rows.Count, 1).End(xlUp).Row + 1
Range("d5").Select
Range("d5").Resize(ActiveCell.End(xlDown)).Copy Range("a" & nextrow)

"halem2" wrote:


hI:

I'm getting an error with this code because Copy Area and Paste Area
are not same size. The Copy Area is the same column but I never know
how many cells it is going to have. The Paste Area is right below the
last cell that contains data in a different column. Any help is
welcome.

'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''
Range("DS5").Select
Range(ActiveCell, ActiveCell.End(xlDown)).Select
Selection.Copy
'
Range("A5").Select
Do
If ActiveCell.Select < "" Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until ActiveCell = ""
'
ActiveSheet.Paste


thanks :confused:


--
halem2
------------------------------------------------------------------------
halem2's Profile: http://www.excelforum.com/member.php...fo&userid=9930
View this thread: http://www.excelforum.com/showthread...hreadid=502069



Toppers

Pasting Error
 
Sorry , last post should say DS5 not D5!

"halem2" wrote:


hI:

I'm getting an error with this code because Copy Area and Paste Area
are not same size. The Copy Area is the same column but I never know
how many cells it is going to have. The Paste Area is right below the
last cell that contains data in a different column. Any help is
welcome.

'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''
Range("DS5").Select
Range(ActiveCell, ActiveCell.End(xlDown)).Select
Selection.Copy
'
Range("A5").Select
Do
If ActiveCell.Select < "" Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until ActiveCell = ""
'
ActiveSheet.Paste


thanks :confused:


--
halem2
------------------------------------------------------------------------
halem2's Profile: http://www.excelforum.com/member.php...fo&userid=9930
View this thread: http://www.excelforum.com/showthread...hreadid=502069



halem2[_56_]

Pasting Error
 

thanks a lot for the help. Truly appreciate it. :)


--
halem2
------------------------------------------------------------------------
halem2's Profile: http://www.excelforum.com/member.php...fo&userid=9930
View this thread: http://www.excelforum.com/showthread...hreadid=502069



All times are GMT +1. The time now is 06:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com