0

I have trawled though hours of searches trying to find an answer to my problem.

It seemed an easy enough task, in that I would like to cut data from sheet1 and paste in sheet 2. I was successful in doing this but the data had to remain in the same locations.

The data is imported and each time the location of where I would like to cut from changes.

I basically need to search column A for the word "Summary" (the only word which is always in the same column), when found I would like to cut the "Summary" row and everything below and across to column G until empty cells (this data is always at the bottom, but the row number will vary)

The cut data needs to be pasted into sheet2 column A row A.

I hope there is someone who has something similar which i could tailor to my own needs.

Thanks

Community
  • 1
  • 1
  • Welcome to StackOverflow. Please note, that this is not a free code-writing service. Yet, we are eager to help fellow programmers (and aspirants) with **their** code. Please read the help topics on [How do I Ask a Good Question](http://stackoverflow.com/help/how-to-ask). You might also want to [take the tour](http://stackoverflow.com/tour) and earn a badge while doing so. Afterwards, please update your question with the VBA code you have written thus far in order to complete the task(s) you wish to achieve. BTW: "row A" in your post is probably a typo and should be row 1, right? – Ralph May 11 '16 at 12:41

1 Answers1

1

This should give you a start:

Sub summary()
    Dim sh1 As Worksheet, sh2 As Worksheet
    Dim N As Long, i As Long, r1 As Range, r2 As Range

    Set sh1 = Sheets("Sheet1")
    Set sh2 = Sheets("Sheet2")
    Set r2 = sh2.Range("A1")

    With sh1
        N = .Cells(Rows.Count, "A").End(xlUp).Row
        For i = 1 To N
            If .Cells(i, "A").Value = "Summary" Then
                Set r1 = Range(.Cells(i, "A"), .Cells(N, "G"))
                r1.Copy r2
            End If
        Next i
    End With
End Sub
Gary's Student
  • 95,722
  • 10
  • 59
  • 99