Consulting

Results 1 to 5 of 5

Thread: help with copy range

  1. #1

    help with copy range

    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
    Attached Files Attached Files

  2. #2
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,646
    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

  3. #3
    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

  4. #4
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,646
    Select all cells and format them according to your wishes.
    Remove all conditonal formatting.
    Maybe then it behaves as you expect it to.

  5. #5

    copy format data

    thank you for the info that help me , and I am sure that now it will save me time

    Quote Originally Posted by snb View Post
    Select all cells and format them according to your wishes.
    Remove all conditonal formatting.
    Maybe then it behaves as you expect it to.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •