I think I could figure out how to do it, but I imagine it would be dirty and the splitting macro is already very consuming so I don't want to add any unnecessary power drains. Is there a way to clean and combine the two? Or should I just leave them separate. Not really a big, one button vs two if that is the case. Also, I am tested the macros again to day and the EDNotepadSplit seems to be taking an excessively long time than it used too. I haven't adjusted the code at any point though.
Sub EDNotepadFormat()
Rows("1:4").Delete
Columns("c").ColumnWidth = 125
Columns("d:l").Delete
Columns("b").ColumnWidth = 30
Columns("a").NumberFormat = "mm/dd/yy hh:mm:ss am/pm"
Columns("a").ColumnWidth = 25
Range("a1:IV65536").Select
Selection.UnMerge
Range("E9").Select
With ActiveSheet.PageSetup
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
End With
Cells.Select
Selection.Rows.AutoFit
ActiveSheet.Cells.Borders.LineStyle = xlLineStyleNone
End Sub
Option Explicit
Sub EDNotepadSplit()
Dim myAreas As Areas, I As Long, ii As Long, n As Long, rng As Range
Application.ScreenUpdating = False
Set myAreas = ActiveSheet.Columns(1).SpecialCells(2).Areas
For I = 1 To myAreas.Count
If myAreas(I)(1).Font.Bold Then
Set rng = myAreas(I).Resize(myAreas(I).Count + 1)
ii = 1
Do While I + ii <= myAreas.Count
If myAreas(I + ii)(1).Font.Bold Then Exit Do
Set rng = Union(rng, myAreas(I + ii))
ii = ii + 1
Loop
n = n + 1: If "Sheet" & n = myAreas.Parent.Parent.Name Then n = n + 1
DeleteSheet "Sheet" & n
myAreas.Parent.Parent.Copy after:=Sheets(Sheets.Count)
With ActiveSheet
.Name = "Sheet" & n: .Cells.ClearContents
rng.EntireRow.Copy .Cells(1)
End With
I = I + ii - 1: Set rng = Nothing
End If
Next
myAreas.Parent.Parent.Select
Application.ScreenUpdating = True
End Sub
Private Sub DeleteSheet(ByVal wsName As String)
On Error Resume Next
Application.DisplayAlerts = False
Sheets(wsName).Delete
Application.DisplayAlerts = True
On Error GoTo 0
End Sub
Bookmarks