Hi All,
I have the following script which deletes columns if the column count is empty.
Can someone please modify the script so that if the column has data but cell 1 of the column is empty then it will put the name "Location" in cell 1 of the column.
If the column count is 0 then it would still delete the column.
I have the following script which deletes columns if the column count is empty.
Can someone please modify the script so that if the column has data but cell 1 of the column is empty then it will put the name "Location" in cell 1 of the column.
If the column count is 0 then it would still delete the column.
Code:
Sub New_Test()
Dim iCol As Integer
With ActiveSheet.UsedRange
For iCol = .Column + .Columns.Count - 1 To 1 Step -1
If IsEmpty(Cells(65536, iCol)) And IsEmpty(Cells(1, iCol)) Then
If Cells(65536, iCol).End(xlUp).Row = 1 Then Columns(iCol).Delete
End If
Next iCol
End With
End Sub