delete columns if cells have no data

  • Thread starter Thread starter wizardmalcolm
  • Start date Start date
W

wizardmalcolm

..Hi
I have a worksheet where rows 1 & 2 and columns A & B are fixed headings.
I would like a macro where any columns (C:BH) are deleted if they have no
data.
All of the cells in the range (C3:BH500) have formulas.
I have tried to adapt other similar solutions found here, but to no avail.
Any help would be greatly appreciated.

Malcolm
 
Post your formulas.

If they are formulas that return a string "" then this macro will do the
job.

Sub test()
For Each cell In ActiveSheet.Range("C1:BH500")
If cell = "" Then
cell.ClearContents
End If
Next cell
End Sub


Gord Dibben MS Excel MVP
 
Hi Gord,

Thank you for your reply.
The formulas collect numbers from a seperate worksheet (called "Quote") if
criterias are met.
The formula for cell C3 for example is =IF(Quote!$J8=C$2,Quote!$P8,0)
C2:BH2 are text headings.
If any columns then contain no numbers in cells 3:500, I would like the
macro to either hide or delete that blank column.

Thanks

Malcolm
 
Back
Top