GerardoLopez22
New Member
- Joined
- Jul 23, 2018
- Messages
- 2
I have a database to be updated every month. I need to filter the table by each criteria in cell C8 and then open another file copy the values from column O and paste them in the database and go to the next filter criteria open the next file and repeat all in the same column. Then for the next execution (next month) this to be done, but the values to be pasted in the next column.
I recorded a macro doing two months for the same filter criteria and obtained this. I do not know how to make the loop for the criteria and then loop for the next column.
There 18 criteria to filter for the 12 months of the year
I recorded a macro doing two months for the same filter criteria and obtained this. I do not know how to make the loop for the criteria and then loop for the next column.
There 18 criteria to filter for the 12 months of the year
Code:
Sub BringVal()
Range("O9:O290").Select
Selection.Copy
Windows("TEST FILE-OEE-OptimiyedCode.xlsm").Activate
ActiveWindow.SmallScroll Down:=-24
Range("O9").Select
ActiveSheet.Paste
Range("O22").Select
ActiveWindow.SmallScroll Down:=-36
Windows("NOM CBG Common Approach OEE Mistakes per 100 m 01-2018.xlsx").Activate
ActiveWindow.Close
Sheets("Database").Select
Range("P9:P290").Select
Selection.Copy
Windows("TEST FILE-OEE-OptimiyedCode.xlsm").Activate
Range("P9").Select
ActiveSheet.Paste
Range("O22").Select
ActiveSheet.Range("$C$8:$AB$3000").AutoFilter Field:=13, Criteria1:=RGB(255 _
, 255, 153), Operator:=xlFilterCellColor
Range("O22:O2996").Select
ActiveWindow.SmallScroll Down:=9
Application.CutCopyMode = False
ActiveWindow.SmallScroll Down:=-15
Range("P66").Select
ActiveSheet.Range("$C$8:$AB$3000").AutoFilter Field:=13
ActiveWindow.SmallScroll Down:=-18
Range("P22").Select
End Sub