I found the below code in this thread (Excel - any way to auto hide empty columns when filtering rows?) which hides columns with only a header in them but no data. It works fine for what I'm doing, but it only does one worksheet, whereas I need it to do the whole workbook.
Hopefully that's an easy change, but I'm new to this - would someone be kind enough to amend the below, please?
Sub KolumnHider() Dim wf As WorksheetFunction Dim i As Long, r As Range Set wf = Application.WorksheetFunction For i = 1 To 1000 Set r = Cells(1, i).EntireColumn If wf.CountA(r) < 2 Then r.Hidden = True Next i End Sub