copy and paste formula

jaypatel

Active Member
Joined
Nov 25, 2002
Messages
389
Hi

What would be the code if looking at some particular text in column F, then copy that particular row to "Summary" tab. The text in question is "starter".

eg if cell f2="Starter" then copy row 2, onto summary sheet.
if cell f3="leaver" then do not copy.
if cell f4="starter" then copy row 4 onto summary sheet (and after the first row that was copied)
if cell f5="starter" then copy row 5 onto summary sheet (and after the first 2 rows that was copied).

Thanks

Jay
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Hi Jay

One way would be to loop thru the range identfying the cells using Find and copy those eg:

Code:
Sub CopyRows()
Dim rFound As Range
Dim strFirstAddress As String

Set rFound = Range("F:F").Find(What:="starter", LookIn:=xlValues, lookat:=xlWhole, searchdirection:=xlNext)

If Not rFound Is Nothing Then
    strFirstAddress = rFound.Address
    Do
        rFound.EntireRow.Copy
        With Sheets("Summary")
            .Cells(.Rows.Count, "A").End(xlUp).Offset(1).PasteSpecial
        End With
        Set rFound = Range("F:F").FindNext(rFound)
    Loop Until rFound.Address = strFirstAddress
End If

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,717
Members
448,985
Latest member
chocbudda

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top