Sub empty_cols_remover()
Dim lc As Long, i As Long, counter As Long
lc = Cells(1, Columns.Count).End(xlToLeft).Column
For i = lc To 1 Step -1
counter = WorksheetFunction.CountA(Range(Cells(2, i), Cells(Rows.Count, i)))
If counter = 0 Then Cells(1, i).EntireColumn.Delete shift:=xlToLeft
Next i
End Sub
żarówki - solver.xlsx | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | |||
1 | Nagłowek1 | Nagłowek2 | Nagłowek3 | Nagłowek4 | Nagłowek5 | Nagłowek6 | Nagłowek7 | Nagłowek8 | Nagłowek9 | Nagłowek10 | Nagłowek11 | Nagłowek12 | Nagłowek13 | ||||
2 | 1 | ||||||||||||||||
3 | |||||||||||||||||
4 | |||||||||||||||||
5 | |||||||||||||||||
6 | aaa | aaa | |||||||||||||||
7 | |||||||||||||||||
8 | |||||||||||||||||
9 | |||||||||||||||||
10 | |||||||||||||||||
11 | |||||||||||||||||
12 | |||||||||||||||||
13 | |||||||||||||||||
14 | |||||||||||||||||
15 | |||||||||||||||||
Sheet2 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
F6 | F6 | =C6 |
żarówki - solver.xlsx | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | |||
1 | Nagłowek3 | Nagłowek6 | Nagłowek9 | |||||||||
2 | 1 | |||||||||||
3 | ||||||||||||
4 | ||||||||||||
5 | ||||||||||||
6 | aaa | aaa | ||||||||||
7 | ||||||||||||
Sheet2 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
B6 | B6 | =A6 |
Sub Delete_Columns()
Dim j As Long
For j = Cells(1, Columns.Count).End(1).Column To 1 Step -1
If Cells(Rows.Count, j).End(3).Row = 1 Then Columns(j).Delete
Next
End Sub
Cells(Rows.Count, j).End(3).Row = 1