Hey guys,
I know there has been many post on the good old internet about this but i can find one that will fix my issue.
What i am trying to do is hide Columns based on a valve that can fall in any row in the column.
[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[TD]I[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD][/TD]
[TD]Hide[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Dont Hide[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD][/TD]
[TD][/TD]
[TD]Dont Hide[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Hide[/TD]
[TD][/TD]
[TD]Dont Hide[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Hide[/TD]
[TD][/TD]
[TD][/TD]
[TD]Hide[/TD]
[TD]Hide[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Dont Hide[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Above is an example of what my spread sheet looks like. In this case i want to be able to hide all of the columns with the Hide comment in it. The hard part is this is how my data looks on all of my sheets.
The code that i have from a previous hide vba i built is this
I have tried to modify the = 0 Then to make it have = "Hide" Then but with no luck to it working.
Any help would be great. Thanks in advance.
I know there has been many post on the good old internet about this but i can find one that will fix my issue.
What i am trying to do is hide Columns based on a valve that can fall in any row in the column.
[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[TD]I[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD][/TD]
[TD]Hide[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Dont Hide[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD][/TD]
[TD][/TD]
[TD]Dont Hide[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Hide[/TD]
[TD][/TD]
[TD]Dont Hide[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Hide[/TD]
[TD][/TD]
[TD][/TD]
[TD]Hide[/TD]
[TD]Hide[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Dont Hide[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Above is an example of what my spread sheet looks like. In this case i want to be able to hide all of the columns with the Hide comment in it. The hard part is this is how my data looks on all of my sheets.
The code that i have from a previous hide vba i built is this
Code:
Sub HideCol()
Dim Column As Long
With ActiveSheet
On Error Resume Next
On Error GoTo 0
For Column = 1 To 29
If Application.CountA(.Range(.Cells(2, Column), Cells(65536, Column))) = 0 Then
.Columns(Column).Hidden = True
End If
Next Column
End With
End Sub
I have tried to modify the = 0 Then to make it have = "Hide" Then but with no luck to it working.
Any help would be great. Thanks in advance.