WxShady13
Board Regular
- Joined
- Jul 24, 2018
- Messages
- 185
- Office Version
- 365
- Platform
- Windows
- Mobile
First off I know the code is messy but I have tried so many things that I am just lost at this point. I have a workbook and a user pastes values into a table (Table3, Sign-In Sheet). After running the Macro (CopyTable) the data from Table3 should copy over to SHMM Sections and from there to CBT Modules. What ends up happening is the copy function currently adds 3 blank lines at the bottom which messes up the subsequent worksheets. I cannot figure out where the blank lines are coming from with the copy. I have stopped the code and verified that it is only highlighting the Table3 data lines.
Code:
Sub CopyTable()
Sheets("SHMM Sections").Unprotect Password:="Brock1234"
'Worksheets("SHMM Sections").Range("A3:CS200").deleteRows
With Worksheets("SHMM Sections").ListObjects("Table4")
If Not .DataBodyRange Is Nothing Then
.DataBodyRange.Delete
End If
End With
Call DeleteCBTRows
Worksheets("Sign-In Sheet").Activate
Dim lastRow As Long
lastRow = Range("C" & Rows.Count).End(xlUp).Row
Worksheets("Sign-In Sheet").Range("A7:D" & lastRow).Copy
Worksheets("SHMM Sections").Range("A3:CS" & lastRow).PasteSpecial xlPasteValues
'Worksheets("SHMM Sections").Activate
lastRow = Range("A" & Rows.Count).End(xlUp).Row
Worksheets("SHMM Sections").Range("A3:D" & lastRow).Copy
Worksheets("CBT Modules").Range("A2:D" & lastRow).PasteSpecial xlPasteValues
Call AutoFill
'Worksheets("SHMM Sections").Range("A3").PasteSpecial = xlPasteValues
Call IFStatements
Sheets("SHMM Sections").Protect Password:="Brock1234"
End Sub