Make sure to rename sheet1 to "Raw data" - also add code shown below - it will create the debit & credit sheets (if they dont already exists) - then the code runs fine - I have no idea if the data is right - but the code executes.
Code:Sub CreatingPositiveNegativeSheet() Dim NewSheetX As Worksheet Astr = "NotExists" For ii = 1 To Worksheets.Count If Worksheets(ii).Name = "Credit" Then Astr = "Exists" Next ii If Astr = "NotExists" Then Set NewSheetX = Worksheets.Add 'This makes it active sheet ActiveSheet.Name = "Credit" ' Name of new End If Astr = "NotExists" For ii = 1 To Worksheets.Count If Worksheets(ii).Name = "Debit" Then Astr = "Exists" Next ii If Astr = "NotExists" Then Set NewSheetX = Worksheets.Add 'This makes it active sheet ActiveSheet.Name = "Debit" ' Name of new sheet End If ThisWorkbook.Worksheets("Raw Data").Activate 'This not need - but will make the Raw Data sheet the active sheet







Reply With Quote
Bookmarks