I'm a VBA novice, and I'm trying to write a macro that deletes all the empty columns between my data. The number and location of the empty columns changes every time.
This is what I have so far from cobbling together previous advice from here and online, but when I run it nothing seems to happen.
Thanks
This is what I have so far from cobbling together previous advice from here and online, but when I run it nothing seems to happen.
Rich (BB code):
Sub FindLastColumn()
' Find last column used in row 9
Dim lc As Long
lc = ActiveSheet.Cells.Find("*", SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column
' Loop through all columns backwards
For c = lc To 1 Step -1
If Cells(11, c).Value = " " Then Cells(11, c).EntireColumn.Delete
Next c
End Sub
Thanks