Consulting

Results 1 to 2 of 2

Thread: code modification needed

  1. #1
    VBAX Newbie
    Joined
    Oct 2011
    Posts
    1
    Location

    code modification needed

    The code below works as an activate sheet event handler for sheet2. I would like to use it to copy rows that meet certain criteria (as it already does) but now I would like it to copy and paste the contents of columns a,b,p,q,r & s (at the moment it copies a-o). Any ideas how this code can be amended to do it?

    [vba]
    Private Sub Worksheet_Activate()
    Rows("3:2850").Delete
    With Sheets("Sheet1")
    For Each rngCell In .Range("B3", .Range("B3").End(xlDown))
    If Len(rngCell.Offset(, 14).Value) Then
    Range("A" & .Rows.Count).End(xlUp).Offset(1).Resize(, 15).Value = rngCell.Offset(, -1).Resize(, 15).Value
    End If
    Next
    End With
    End Sub
    [/vba]

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    Quote Originally Posted by TasCat09
    and paste the contents of columns a,b,p,q,r & s
    to columns a,b,p,q,r & s or to columns a,b,c,d,e & f?
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

Posting Permissions

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