Afro_Cookie
Board Regular
- Joined
- Mar 17, 2020
- Messages
- 103
- Office Version
- 365
- Platform
- Windows
I had some help with some code from this thread ( Macro crashes with button, works perfectly if run line by line ) and have modified it slightly since then, see below.
When I run it, it duplicates the number of lines I have but makes them blank. I added a special cells portion to delete the data in a column with no data, but it does not seem to be working.
Can someone please help me delete the blank rows that are added or identify why they are being added?
When I run it, it duplicates the number of lines I have but makes them blank. I added a special cells portion to delete the data in a column with no data, but it does not seem to be working.
Can someone please help me delete the blank rows that are added or identify why they are being added?
VBA Code:
Sub S0rt()
Dim tbl As Range
Set tbl = Sheets("WSG0106_CON10170").AutoFilter.Range
Set tbl = tbl.Resize(tbl.Rows.Count - 1)
Set tbl = tbl.Offset(1)
Sheets("WSG0106_CON10170").Select
Range("B:C, E:E").ClearContents
Range("A:A").Delete
Range("AC:AC").Delete
Columns(5).Insert
tbl.Copy Sheets("Table").Range("A" & Cells.Rows.Count).End(xlUp).Offset(1, 0)
ActiveWorkbook.Queries("WSG0106_CON10170").Delete
Sheets("WSG0106_CON10170").Delete
On Error Resume Next
Sheets("Table").Select
Application.ScreenUpdating = False
Columns("C:C").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
Application.ScreenUpdating = True
End Sub