Sjon1974
New Member
- Joined
- Apr 1, 2020
- Messages
- 38
- Office Version
- 365
- Platform
- Windows
All,
I changed a worksheet into a table, but my import code does not work anymore.
I am refering to WS2 "Database" when i changed into a Table the macro is not working anymore.
What is going wrong:
Excel completly freezes and at the end is creating a 1004 error, so i have to change the range or something
I changed a worksheet into a table, but my import code does not work anymore.
VBA Code:
Sub Import()
Dim ws1 As Worksheet, ws2 As Worksheet
Dim LastRow As Long
Dim Cl As Range
Set ws1 = ThisWorkbook.Sheets("Import")
Set ws2 = ThisWorkbook.Sheets("Database")
LastRow = ws2.Cells(Rows.Count, "A").End(xlUp).Row
ws1.Range("A7").AutoFilter 1, "*"
ws1.AutoFilter.Range.Offset(1).EntireRow.Copy ws2.Range("a" & LastRow + 1)
ws1.AutoFilterMode = False
Call deleteBlankRows
End Sub
Sub deleteBlankRows()
Dim ws1 As Worksheet, ws2 As Worksheet
Dim LastRow As Long
Dim Cl As Range
Set ws2 = ThisWorkbook.Sheets("Database")
Application.ScreenUpdating = False
ws2.Columns("G:G").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
Application.ScreenUpdating = True
End Sub
I am refering to WS2 "Database" when i changed into a Table the macro is not working anymore.
What is going wrong:
Excel completly freezes and at the end is creating a 1004 error, so i have to change the range or something