bhavesh218
New Member
- Joined
- Jul 15, 2021
- Messages
- 1
- Office Version
- 365
- 2013
- Platform
- Windows
Hello,
I'm trying to split one Master sheet into multiple sheets based on the Date Column and I have some Cover data which I want to copy all over the sheets.
I'm using below VBA Script for that,
Sub SplitandFilterSheet()
Dim Splitcode As Range
Sheets("Master").Select
Set Splitcode = Range("Splitcode")
For Each cell In Splitcode
Sheets("Master").Copy After:=Worksheets(Sheets.Count)
ActiveSheet.Name = cell.Value
With ActiveWorkbook.Sheets(cell.Value).Range("MasterData") .AutoFilter Field:=6, Criteria1:="NOT EQUAL TO" & cell.Value, Operator:=xlFilterValues .Offset(1, 0).SpecialCells(xlCellTypeVisible).EntireRow.Delete
End With
ActiveSheet.AutoFilter.ShowAllData
Next cell
End Sub
I'm getting Error 1004 on this script
Please help me out with this. Thanks
I'm trying to split one Master sheet into multiple sheets based on the Date Column and I have some Cover data which I want to copy all over the sheets.
I'm using below VBA Script for that,
Sub SplitandFilterSheet()
Dim Splitcode As Range
Sheets("Master").Select
Set Splitcode = Range("Splitcode")
For Each cell In Splitcode
Sheets("Master").Copy After:=Worksheets(Sheets.Count)
ActiveSheet.Name = cell.Value
With ActiveWorkbook.Sheets(cell.Value).Range("MasterData") .AutoFilter Field:=6, Criteria1:="NOT EQUAL TO" & cell.Value, Operator:=xlFilterValues .Offset(1, 0).SpecialCells(xlCellTypeVisible).EntireRow.Delete
End With
ActiveSheet.AutoFilter.ShowAllData
Next cell
End Sub
I'm getting Error 1004 on this script
Please help me out with this. Thanks