Firstly I have to apologise as this is my first attempt at any VBA coding!
I am trying to find a way of automating a process whereby I extract data from a single data sheet with multiple columns in it into several separate worksheets.
My source data sheet has multiple column headings that are identified by their heading name, column number and column reference.
I am looking for some code that will (for the 2 specified column headings in each of my output sheets:
- perform an auto filter selection (=Blanks for column 1 in the operation, <> Blanks for column 2 in the operation)
- copy and paste the returned data into a specified output sheet
- reset the auto filters in data sheet
- move onto the next output sheet, select the next two relevant columns identified in the next output sheet
- perform an auto filter selection (=Blanks for column 1 in the operation, <> Blanks for column 2 in the operation)
- copy and paste the returned data into a specified output sheet
- reset the auto filters in data sheet etc.
I can do this for 1 sheet and repeat but fall over due to the data sheet columns not necessarily remaining in the same order (as new activity milestones are added between the activity I am counting are added).
My crude code is below:
Sub FcastSFR()
'
' FcastSFR Macro
'
'
Application.ScreenUpdating = False
Range("A23:B345").Select
Selection.ClearContents
Sheets("MOAT").Select
ActiveSheet.ShowAllData
ActiveSheet.Range("$A$1:$DT$5000").AutoFilter Field:=17, Criteria1:="="
ActiveSheet.Range("$A$1:$DT$5000").AutoFilter Field:=15, Criteria1:="<>"
Range("O1:P631").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("SFR Submit").Select
Range("A23").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
I am looking for help to make the Field=17/Field=15 and the Range ("O1:P631") be selected from the relevant output sheets.
Help!!