Hi - i have a Source Data sheet that i need to split up into 28 diff sheets based on criteria- we're good so far
then i used the filter function to take whats in the source sheet and put the right data into the right sheet - also good so far
however, i then used AutoFilter to filter out a certain status but the code break if there is nothing to filter
please excuse my very basic code, i am learning as i go
but essentially, this same code below is repeated 28 times for all the tabs i create. basically, on the source data there wont always be all 28 of the different values, but i still need the tab to create (and be empty) if there is nothing for that value. but it breaks when it gets to filtering out the Complete because the tab is empty.
Sheets.Add.Name = "SCI"
Range("A1").Value = "SCI"
Range("A2").Formula2 = "=FILTER('SOURCE DATA'!A2:M10000,ISNUMBER(SEARCH(A1,'SOURCE DATA'!A2:A10000)))"
ActiveSheet.UsedRange.RemoveDuplicates Columns:=7, Header:=xlYes
ActiveSheet.UsedRange.AutoFilter Field:=13, Criteria1:="<>Complete"
ActiveSheet.Range("C2", "C10000").NumberFormat = "mm/dd/yyyy"
ActiveSheet.Range("L2", "L10000").NumberFormat = "mm/dd/yyyy"