I found this macro online that I've been trying to use, but I need it to copy the first 10 rows and it is only copying row 10... It also isn't keeping the formatting of the sheet, and I need it to automatically hide Columns A-D. If possible, also freeze Rows 1-10, and Column E. It does pull over the 'Titles' as the tab names, though so that is great.
Sub SplitData()
Const NameCol = "D"
Const HeaderRow = 10
Const FirstRow = 11
Dim SrcSheet As Worksheet
Dim TrgSheet As Worksheet
Dim SrcRow As Long
Dim LastRow As Long
Dim TrgRow As Long
Dim FeeExp As String
Application.ScreenUpdating = False
Set SrcSheet = ActiveSheet
LastRow = SrcSheet.Cells(SrcSheet.Rows.Count, NameCol).End(xlUp).Row
For SrcRow = FirstRow To LastRow
FeeExp = SrcSheet.Cells(SrcRow, NameCol).Value
Set TrgSheet = Nothing
On Error Resume Next
Set TrgSheet = Worksheets(FeeExp)
On Error GoTo 0
If TrgSheet Is Nothing Then
Set TrgSheet = Worksheets.Add(After:=Worksheets(Worksheets.Count))
TrgSheet.Name = FeeExp
SrcSheet.Rows(HeaderRow).Copy Destination:=TrgSheet.Rows(HeaderRow)
End If
TrgRow = TrgSheet.Cells(TrgSheet.Rows.Count, NameCol).End(xlUp).Row + 1
SrcSheet.Rows(SrcRow).Copy Destination:=TrgSheet.Rows(TrgRow)
Next SrcRow
Application.ScreenUpdating = True
End Sub
Got this code from here: https://social.msdn.microsoft.com/Fo...forum=exceldev
There are just so many updates to it that I don't know what was working and what isn't, and they also adjusted it so it makes brand new sheets, but I don't need that...
Bookmarks