Hi,
Can anyone help me with this ? I am currently using a macro that would hide all the column which sums to 0 including (A:E) which are text but i only want it to work from Column (F:MC). Please note that i have row headers on row 9 throughout these columns. Any help would be greatly appreciated
Sub HideZeroColumn()
Dim anyWS As Worksheet
Dim anyTotalRow As Range
Dim anyCell As Range
Set anyWS = ActiveSheet
Set anyTotalRow = anyWS.Range(Cells(ActiveCell.Row, 2).Address, _
Cells(ActiveCell.Row, _
anyWS.Cells(ActiveCell.Row, Columns.Count). _
End(xlToLeft).Column))
Application.ScreenUpdating = False
anyTotalRow.Columns.EntireColumn.Hidden = False
For Each anyCell In anyTotalRow
If IsEmpty(anyCell) Or anyCell = 0 Then
anyCell.EntireColumn.Hidden = True
End If
Next
Set anyTotalRow = Nothing
Set anyWS = Nothing
End Sub
Can anyone help me with this ? I am currently using a macro that would hide all the column which sums to 0 including (A:E) which are text but i only want it to work from Column (F:MC). Please note that i have row headers on row 9 throughout these columns. Any help would be greatly appreciated
Sub HideZeroColumn()
Dim anyWS As Worksheet
Dim anyTotalRow As Range
Dim anyCell As Range
Set anyWS = ActiveSheet
Set anyTotalRow = anyWS.Range(Cells(ActiveCell.Row, 2).Address, _
Cells(ActiveCell.Row, _
anyWS.Cells(ActiveCell.Row, Columns.Count). _
End(xlToLeft).Column))
Application.ScreenUpdating = False
anyTotalRow.Columns.EntireColumn.Hidden = False
For Each anyCell In anyTotalRow
If IsEmpty(anyCell) Or anyCell = 0 Then
anyCell.EntireColumn.Hidden = True
End If
Next
Set anyTotalRow = Nothing
Set anyWS = Nothing
End Sub