I have written the following code that clears a page of data, copies the new data from another book, selects the new region and turns it into a table. It all works except when I add new data it shows up but the added rows do not format alternating row colors like the rest of the table. They are the background color instead.
Code:
Sub getData()
Dim table As ListObject
Workbooks("Front Desk.xlsm").Sheets("Search Page").Unprotect Password:="*********"
Workbooks("Front Desk.xlsm").Sheets("Search Page").Range("B14").CurrentRegion.ClearContents
Workbooks("Intake Data.xlsx").Sheets("Intake Data").Range("A1").CurrentRegion.Copy
Workbooks("Front Desk.xlsm").Sheets("Search Page").Range("B14").PasteSpecial xlPasteValues
Set table = Sheet1.ListObjects.Add(xlSrcRange, Workbooks("Front Desk.xlsm").Sheets("Search Page").Range("B14").CurrentRegion, , xlYes)