PDA

View Full Version : help with copy range



Pilot5000
03-04-2014, 12:41 PM
I got the sheet (sheet2)with certain data, I also have the following code that suppose to copy the data from sheet(sheet2) to sheet(sheet1), the funny thing is that as long as i place the data in Sheet (sheet2) starting in column E the code work fine as long, but the moment I try to start the data column A the data is copied but I get Run time error 104 with the message "run time error 104 copy area and paste area are not the same size" any idea why and suggestion how to fix that ?????? my code is


Sub COPY_1()

Dim i As Integer

Application.ScreenUpdating = False
Worksheets("Sheet2").Select

For i = 5 To 23 Step 2
If i <> 17 Then Range(Cells(2, i), Cells(2, i).End(xlDown).Offset(, 1)).Copy Destination:=Worksheets("sheet1").Range("A" & Rows.Count).End(xlUp).Offset(3)
Next
Application.ScreenUpdating = True
End Sub

snb
03-04-2014, 01:11 PM
sub M_snb()
with sheets("sheet2").cells(2,1).currentregion
for j=1 to .columns.count-1 step 2
.columns(j).resize(,2).copy sheets("sheet1").cells(rows.count,1).end(xlup).offset(2)
next
end with
End Sub

Pilot5000
03-04-2014, 11:43 PM
thank you very much , it working now as I need, jus one more little question , lately (wasn't like that in the past)when I copy & past something in excel the data I paste appear in red and not black as it's , I am not doing special paste or something just ctrl C and ctrl V ,is that something that can cause me problems with my excel ??? or what

snb
03-05-2014, 02:36 AM
Select all cells and format them according to your wishes.
Remove all conditonal formatting.
Maybe then it behaves as you expect it to.

Pilot5000
03-06-2014, 05:58 AM
thank you for the info that help me , and I am sure that now it will save me time


Select all cells and format them according to your wishes.
Remove all conditonal formatting.
Maybe then it behaves as you expect it to.