Adding to a macro

stevelake

Board Regular
Joined
Jun 6, 2007
Messages
102
Hi

I have a macro (below) that will

Filter data from "Data Entry" then copy and paste it to sheet "June07"


What l would like to do is add to the macro so that it also copies to sheet "July07", "Aug07" etc

The paste area is the same on all pages

Is it possible?

Thanks in advance

Steve

Sub FilterData()

Sheets("Data Entry").Activate
Rows("5:1000").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:=Sheets("June07").Range("A7").Value

ActiveSheet.UsedRange.Offset(1, 0).SpecialCells _
(xlCellTypeVisible).EntireRow.Copy Sheets("June07").Range("A36")

ActiveSheet.AutoFilterMode = False
Sheets("Data Entry").Select
Range("A5").Select

Sheets("June07").Select
Range("A36").Select
End Sub
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

galileogali

Well-known Member
Joined
Oct 14, 2005
Messages
748
you can put in a cell a validation of the List type that stores:
January, February,…, June, July,….
and
in another one next to that: "07","08","09" (format cell = Text)….
Let us suppose that the cells are: “H1” and “I1”,

then you can include a sentence in your Macro:

Code:
.........................................
Dim strMonthYear as string

strMonthYear = [H1] & [I1] 
..........................................
Then it replaces in the Macro “June07” to strMonthYear.

GALILEOGALI

excuse me por my sioux-english
 

Forum statistics

Threads
1,181,607
Messages
5,930,871
Members
436,764
Latest member
avalladarez

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
Top