mafallaize
New Member
- Joined
- Aug 23, 2011
- Messages
- 31
Hi all,
I usually come to this site through a google search, it surely is the best for answering excel problems. Now I thought its time to share my excel experiences, so here is one you may have come across. This macro is designed to copy and insert data from one sheet to another according to the month of the year. It tends to work once but thereafter fails to insert the copied cells and instead inserts a single cell. Does anyone have any idea why this happens or how to fix it?
Sub ()
Sheets("2011 Reviewed").Select
Dim Jan As Range
Set Jan = Range("A10")
Dim Feb As Range
Set Feb = Range("A13")
Dim Mar As Range
'Prevent pop ups
On Error Resume Next
Application.DisplayAlerts = False
'Clear 2011 Reviewed
Sheets("2011 Reviewed").Select
Cells.Select
Selection.Clear
Sheets("Template2").Select
Cells.Select
CutCopyMode = False
Selection.Copy
Sheets("2011 Reviewed").Select
Range("A1").Select
ActiveSheet.Paste
'Filter and copy Processor to 2011 Reviewed
Sheets("Processor").Select
ActiveSheet.Range("$1:$1000").AutoFilter Field:=7, Operator:=xlFilterValues _
, Criteria2:=Array(1, "1/31/2011")
Rows("$2:$1993").SpecialCells(xlCellTypeVisible).Select
CutCopyMode = False
Selection.Copy
Sheets("2011 Reviewed").Select
Jan.Select
Selection.Insert Shift:=xlDown
Sheets("Processor").Select
ActiveSheet.Range("$1:$5994").AutoFilter Field:=7, Operator:=xlFilterValues _
, Criteria2:=Array(1, "2/28/2011")
Rows("$2:$1993").SpecialCells(xlCellTypeVisible).Select
CutCopyMode = False
Selection.Copy
Sheets("2011 Reviewed").Select
Feb.Select
Selection.Insert Shift:=xlDown
End Sub
I usually come to this site through a google search, it surely is the best for answering excel problems. Now I thought its time to share my excel experiences, so here is one you may have come across. This macro is designed to copy and insert data from one sheet to another according to the month of the year. It tends to work once but thereafter fails to insert the copied cells and instead inserts a single cell. Does anyone have any idea why this happens or how to fix it?
Sub ()
Sheets("2011 Reviewed").Select
Dim Jan As Range
Set Jan = Range("A10")
Dim Feb As Range
Set Feb = Range("A13")
Dim Mar As Range
'Prevent pop ups
On Error Resume Next
Application.DisplayAlerts = False
'Clear 2011 Reviewed
Sheets("2011 Reviewed").Select
Cells.Select
Selection.Clear
Sheets("Template2").Select
Cells.Select
CutCopyMode = False
Selection.Copy
Sheets("2011 Reviewed").Select
Range("A1").Select
ActiveSheet.Paste
'Filter and copy Processor to 2011 Reviewed
Sheets("Processor").Select
ActiveSheet.Range("$1:$1000").AutoFilter Field:=7, Operator:=xlFilterValues _
, Criteria2:=Array(1, "1/31/2011")
Rows("$2:$1993").SpecialCells(xlCellTypeVisible).Select
CutCopyMode = False
Selection.Copy
Sheets("2011 Reviewed").Select
Jan.Select
Selection.Insert Shift:=xlDown
Sheets("Processor").Select
ActiveSheet.Range("$1:$5994").AutoFilter Field:=7, Operator:=xlFilterValues _
, Criteria2:=Array(1, "2/28/2011")
Rows("$2:$1993").SpecialCells(xlCellTypeVisible).Select
CutCopyMode = False
Selection.Copy
Sheets("2011 Reviewed").Select
Feb.Select
Selection.Insert Shift:=xlDown
End Sub