Jamie Harris

New Member
Joined
Feb 26, 2017
Messages
4
I Have a data sheet called 2017, in the R column there is the months. There is a January sheet i want this sheet to extract all the data from the 2017 sheet if in 2017 sheet column r it says January. here is the file you can check it out im so confused... Click Me
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
This script will copy all the rows in sheet named "2017" if the value in column "R" says "January"
And the row will be copied into a sheet named "January"

This script assumes you already have a sheet named "January" in the active workbook.

If you want this script to also work on other months then you must say so.
And if so be sure and point out if all the sheets have already been made or does the script have to make the sheet also.

I never click on links. And specific details are always important.


Code:
Sub Copy_Month()
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Dim Lastrowa As Long
Sheets("2017").Activate
Lastrow = Sheets("2017").Cells(Rows.Count, "R").End(xlUp).Row
Lastrowa = Sheets("January").Cells(Rows.Count, "R").End(xlUp).Row

    For i = 1 To Lastrow
        If Cells(i, "R").Value = "January" Then
            Rows(i).Copy Destination:=Sheets("January").Rows(Lastrowa)
            Lastrowa = Lastrowa + 1
        End If
    Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0
It will if you run the script again. You never said you exspect this to happen automatically every time you add data. If thats what you want you need to explain in detail when you want the script to be activated.
Okay with the macro you have gave it works but it doesn't update when there is a new January job add to the 2017 sheet?
 
Upvote 0
And you need to explain if January is going to be the only month. And I asked several questions in post #2 you never answered.
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,559
Members
449,089
Latest member
Motoracer88

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