Macro to hide Columns
This is case Sensitive:
Do this if you dont want it to b
Private Sub Macro1( )
Dim MyStr as String, Val as Strin
MyStr = "YOURVALUE" '<< All Caps
For Each c in Selection
Val = UCase( Cstr(c.value))
if InStr(1, Val, MyStr)0 Then c.EntireColumn.Hidden = True
Nex
End Sub
----- chris wrote: ----
I don't know how your data is set up so your gonna have to manually select what range you want processed
i don't recommend you select the entire row if you dont have to, but it will work either way
create a new macro and put this code in i
Private Sub Macro1( ) '<< this should be provide
Dim MyStr as Strin
MyStr = "YourValue
For Each c in Selection
if InStr(1, Cstr(c.value), MyStr)0 Then c.EntireColumn.Hidden = True
Nex
End Sub '<< this should be provide
----- Andy Ward wrote: ----
I'm trying to write a Macro that will cycle through each cell in a row (except
the first and last column of the table) and hide the entire column if the cell
doesn't contain a certain word, the word may be on it's own or within a
sentance
I can't use the sort command as the table contains many merged cells et
Can any one give me some pointers as to where to start - I have very limited
programming knowledge - have done basic programming but not for a
couple of years or in VBA
Many Thank
And
|