VBA: How to hide merge column - TechRepublic
Question
August 4, 2008 at 04:10 AM
haris

VBA: How to hide merge column

by haris . Updated 17 years, 11 months ago

hi,

i’m getting this coding from here…

Sub FilterColumns()

‘ FilterColumns Macro
‘ Macro created 11/08/2007 by Alan

Dim MyRange As Range
Dim c As Range

‘ Set Range to Filter
Set MyRange = ActiveSheet.Range(“a4:z4”)
‘ Loop through Range
For Each c In MyRange
If c.Value = 0 Then
‘ Hide Column When Value Found
Columns(c.Column).Hidden = True
End If
Next
End Sub

But i got problem for merge column…

example: i’m having merge column (b4 and c4), (d4 and e4) and etc… then i’m running this FilterColumns function… it will hide also column c4 and e4 also (i thinks because c4 and e4 also value= 0. Supposely i just want to hide empty merge column only… so how to solve it.

thanks

This discussion is locked

All Comments