Hi there,
I haven't checked all of your code, but this suggestion might be a good place to start!
Regarding
Is this because the macro continues to run indefinitely?
the macro isn't running "indefinitely", but because of
For Each r In newMembers.Worksheets(1).Rows
it's happily processing all 65536 rows in the worksheet!
Try the following code which will limit the macro's "attention" to the rows between Row 2 and the row which contains the last data record:
Sub ParseInputToWorksheets()
Dim memberLists As Workbook
Dim chapterColumn As String
Set memberLists = ActiveWorkbook
chapterColumn = "B"
Dim newMembers As Workbook
Dim newMembersFilePath As String
newMembersFilePath = "C:\Creeds\Database\SAE\NewList.xlsx"
Set newMembers = GetObject(newMembersFilePath)
Dim memberRows As Long
memberRows = newMembers.Worksheets(1).UsedRange.Rows.Count
Dim r As Range
For Each r In newMembers.Worksheets(1).Range(newMembers.Worksheets(1).Rows(2), _
newMembers.Worksheets(1).Rows(memberRows))
Dim chapterName As String
chapterName = r.Cells(1, chapterColumn)
Call CopyToChapter(chapterName, r)
Next
End Sub
I hope this helps - please let me know how you get on or if you need anything further.
Regards,
Greg M
Bookmarks