VBA/Macro to copy and paste rows into different sheets

srose88

New Member
Joined
Mar 15, 2013
Messages
16
Hi,

I have the data set below which is a report extract (rerun and pasted over weekly) in sheet "Data Sheet", I need a VBA or Macro to extract all the data from Won rows into a different sheet in the sheet named "Won". I also need it to pull the data on Open rows into the sheet named "Pipeline".

On the Won and Pipeline sheets the row data needs to be pasted from cell B8 across/down.

Is it also possible to add buttons for each of these macros/executions onto the won and pipeline sheets to automate the process?

Thanks in advance.


Status
Date openedDate closedNameMilestoneNameCompetitorsDescriptionStatusConfidence% completeProductsValueAssigned toStart dateEnd dateCPMImpressionsInternal IO#Agency Group
Open16/08/2013 09:15Lead–1200First contactAAAAAAAAAAAAOpen10%0AAAA£50,000AAAA01/01/2014 00:0030/03/2014 23:00AAAAAAAA
Won17/04/2013 13:3217/04/2013 13:40Lead–1114First contactAAAAAAAAAAAAWon100%0AAAA£600AAAA22/04/2013 00:0028/04/2013 00:00£2.00300000AAAAAAAA
Won17/04/2013 13:3717/04/2013 13:40Lead–1116First contact
AAAAAAAAAAAAWon100%0AAAA£600AAAA06/05/2013 00:0012/05/2013 00:00£2.00300000AAAAAAAA
Lost20/05/2013 09:3727/06/2013 10:55Lead–1141First contactAAAAAAAAAAAALost10%0AAAA£12,000AAAA01/08/2013 00:0031/08/2013 00:00AAAAAAAA
Cancelled08/04/2013 09:5717/06/2013 16:42Lead–1101IOAAAAAAAAAAAACancelled10%75AAAA£5,000AAAA01/07/2013 00:0031/08/2013 00:00AAAAAAAA

<colgroup><col><col span="2"><col span="2"><col><col><col><col><col><col><col><col><col><col span="2"><col span="2"><col><col></colgroup><tbody>
</tbody>
 
recognized an error as no status will be in the Sort sheet I have fixed this the sort macro

Code:
Sub test()
Dim Ar As Variant
Dim i As Integer
Dim lc As Integer
Dim fnd As Integer

Ar = Array("Status", "Date closed", "Internal IO#", "Assigned to", "Name", "Agency Group", "Competitors", "Description", "Products", "Impressions", "Start date", "End date", "CPM", "Value")

    For i = 0 To UBound(Ar)
        fnd = Sheets("Data Sheet").Rows(1).Find(Ar(i)).Column
        Sheets("Data Sheet").Columns(fnd).Copy Sheets("Sort").Cells(1, i + 1)
    Next i

End Sub

The Code for Sheet Won

Code:
Private Sub CommandButton1_Click()
'Sheet Won
Dim rngFiltered As Range
Dim rngTarget As Range
      Dim Rng As Range
      
With Sheets("Sort")
  .AutoFilterMode = False
  .Range("A1:D1").AutoFilter
  .Range("A1:D1").AutoFilter Field:=1, Criteria1:="Won"
    Set Rng = .Range("A2:A" & .Range("A" & .Rows.Count).End(xlUp).Row).Resize(, 20).SpecialCells(xlCellTypeVisible)
    Rng.Copy Sheets("Won").Cells(.Rows.Count, "A").End(xlUp).Offset(1)
End With
End Sub

Code for Sheet Pipeline
Code:
Private Sub CommandButton1_Click()
'Sheet Pipeline
Dim rngFiltered As Range
Dim rngTarget As Range
      Dim Rng As Range
      
With Sheets("Sort")
  .AutoFilterMode = False
  .Range("A1:D1").AutoFilter
  .Range("A1:D1").AutoFilter Field:=1, Criteria1:="Open"
    Set Rng = .Range("A2:A" & .Range("A" & .Rows.Count).End(xlUp).Row).Resize(, 20).SpecialCells(xlCellTypeVisible)
    Rng.Copy Sheets("Pipeline").Cells(.Rows.Count, "A").End(xlUp).Offset(1)
End With
End Sub
 
Upvote 0

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

Forum statistics

Threads
1,214,975
Messages
6,122,538
Members
449,088
Latest member
RandomExceller01

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