troelsi
06-03-2007, 10:40 AM
Hi
Hello
I need to delete columns that doesn't contain data, and in order to do that. I believe I first have to create a collection og those columns that doesn't contain data. This is what I've come up with so far but unfortunately it doesn't work:
dim s as collection
For i = 1 To r
If WorksheetFunction.Sum(Range(Cells(2, i + 1), Cells(p + 1, i + 1))) = 0 Then
s.Add (Columns(i + 1))
End If
Next i
For Each comlumns In s
Columns.Delete Shift:=xlToLeft
Next
Hello
I need to delete columns that doesn't contain data, and in order to do that. I believe I first have to create a collection og those columns that doesn't contain data. This is what I've come up with so far but unfortunately it doesn't work:
dim s as collection
For i = 1 To r
If WorksheetFunction.Sum(Range(Cells(2, i + 1), Cells(p + 1, i + 1))) = 0 Then
s.Add (Columns(i + 1))
End If
Next i
For Each comlumns In s
Columns.Delete Shift:=xlToLeft
Next