+ Reply to Thread
Results 1 to 6 of 6

Hide Column - With text in cell

Hybrid View

  1. #1
    O&O
    Guest

    Hide Column - With text in cell

    How can I make this macro work if my cells contain a text e.g AAA
    instead of 0 & work on Sheet1, Sheet2 & Sheet3

    Sub Test1()
    Dim cell As Range
    For Each cell In Range("c1:j1")
    If cell.Value <> 0 Then
    cell.EntireColumn.Hidden = True
    End If
    Next cell
    End Sub

    Thxs


  2. #2
    Bob Phillips
    Guest

    Re: Hide Column - With text in cell

    Sub Test1()
    Dim cell As Range
    For Each cell In Range("c1:j1")
    If cell.Value <> "AAA" Then
    cell.EntireColumn.Hidden = True
    End If
    Next cell
    End Sub


    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "O&O" <albert.ng@oneandonlyresorts.mu> wrote in message
    news:1131527150.656272.205130@z14g2000cwz.googlegroups.com...
    > How can I make this macro work if my cells contain a text e.g AAA
    > instead of 0 & work on Sheet1, Sheet2 & Sheet3
    >
    > Sub Test1()
    > Dim cell As Range
    > For Each cell In Range("c1:j1")
    > If cell.Value <> 0 Then
    > cell.EntireColumn.Hidden = True
    > End If
    > Next cell
    > End Sub
    >
    > Thxs
    >




  3. #3
    O&O
    Guest

    Re: Hide Column - With text in cell

    Thxs - but how about Sheet1 &Sheet2 &Sheet3
    thxs
    Bob Phillips wrote:
    > Sub Test1()
    > Dim cell As Range
    > For Each cell In Range("c1:j1")
    > If cell.Value <> "AAA" Then
    > cell.EntireColumn.Hidden = True
    > End If
    > Next cell
    > End Sub
    >
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "O&O" <albert.ng@oneandonlyresorts.mu> wrote in message
    > news:1131527150.656272.205130@z14g2000cwz.googlegroups.com...
    > > How can I make this macro work if my cells contain a text e.g AAA
    > > instead of 0 & work on Sheet1, Sheet2 & Sheet3
    > >
    > > Sub Test1()
    > > Dim cell As Range
    > > For Each cell In Range("c1:j1")
    > > If cell.Value <> 0 Then
    > > cell.EntireColumn.Hidden = True
    > > End If
    > > Next cell
    > > End Sub
    > >
    > > Thxs
    > >



  4. #4
    Bob Phillips
    Guest

    Re: Hide Column - With text in cell



    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "O&O" <albert.ng@oneandonlyresorts.mu> wrote in message
    news:1131528170.073883.159920@o13g2000cwo.googlegroups.com...
    > Thxs - but how about Sheet1 &Sheet2 &Sheet3
    > thxs
    > Bob Phillips wrote:
    > > Sub Test1()
    > > Dim cell As Range
    > > For Each cell In Range("c1:j1")
    > > If cell.Value <> "AAA" Then
    > > cell.EntireColumn.Hidden = True
    > > End If
    > > Next cell
    > > End Sub
    > >
    > >
    > > --
    > >
    > > HTH
    > >
    > > RP
    > > (remove nothere from the email address if mailing direct)
    > >
    > >
    > > "O&O" <albert.ng@oneandonlyresorts.mu> wrote in message
    > > news:1131527150.656272.205130@z14g2000cwz.googlegroups.com...
    > > > How can I make this macro work if my cells contain a text e.g AAA
    > > > instead of 0 & work on Sheet1, Sheet2 & Sheet3
    > > >
    > > > Sub Test1()
    > > > Dim cell As Range
    > > > For Each cell In Range("c1:j1")
    > > > If cell.Value <> 0 Then
    > > > cell.EntireColumn.Hidden = True
    > > > End If
    > > > Next cell
    > > > End Sub
    > > >
    > > > Thxs
    > > >

    >




  5. #5
    Bob Phillips
    Guest

    Re: Hide Column - With text in cell

    Sorry, didn't realise you want that included in the code

    Sub Test1()
    Dim cell As Range
    Dim arySheets
    Dim sh As Worksheet

    arySheets = Array("Sheet1", "Sheet2", "Sheet3")
    For Each sh In Worksheets(arySheets)
    For Each cell In sh.Range("c1:j1")
    If cell.Value <> "AAA" Then
    cell.EntireColumn.Hidden = True
    End If
    Next cell
    Next sh
    End Sub




    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "O&O" <albert.ng@oneandonlyresorts.mu> wrote in message
    news:1131528170.073883.159920@o13g2000cwo.googlegroups.com...
    > Thxs - but how about Sheet1 &Sheet2 &Sheet3
    > thxs
    > Bob Phillips wrote:
    > > Sub Test1()
    > > Dim cell As Range
    > > For Each cell In Range("c1:j1")
    > > If cell.Value <> "AAA" Then
    > > cell.EntireColumn.Hidden = True
    > > End If
    > > Next cell
    > > End Sub
    > >
    > >
    > > --
    > >
    > > HTH
    > >
    > > RP
    > > (remove nothere from the email address if mailing direct)
    > >
    > >
    > > "O&O" <albert.ng@oneandonlyresorts.mu> wrote in message
    > > news:1131527150.656272.205130@z14g2000cwz.googlegroups.com...
    > > > How can I make this macro work if my cells contain a text e.g AAA
    > > > instead of 0 & work on Sheet1, Sheet2 & Sheet3
    > > >
    > > > Sub Test1()
    > > > Dim cell As Range
    > > > For Each cell In Range("c1:j1")
    > > > If cell.Value <> 0 Then
    > > > cell.EntireColumn.Hidden = True
    > > > End If
    > > > Next cell
    > > > End Sub
    > > >
    > > > Thxs
    > > >

    >




  6. #6
    al007
    Guest

    Re: Hide Column - With text in cell

    thxs!!!
    Bob Phillips wrote:
    > Sorry, didn't realise you want that included in the code
    >
    > Sub Test1()
    > Dim cell As Range
    > Dim arySheets
    > Dim sh As Worksheet
    >
    > arySheets = Array("Sheet1", "Sheet2", "Sheet3")
    > For Each sh In Worksheets(arySheets)
    > For Each cell In sh.Range("c1:j1")
    > If cell.Value <> "AAA" Then
    > cell.EntireColumn.Hidden = True
    > End If
    > Next cell
    > Next sh
    > End Sub
    >
    >
    >
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "O&O" <albert.ng@oneandonlyresorts.mu> wrote in message
    > news:1131528170.073883.159920@o13g2000cwo.googlegroups.com...
    > > Thxs - but how about Sheet1 &Sheet2 &Sheet3
    > > thxs
    > > Bob Phillips wrote:
    > > > Sub Test1()
    > > > Dim cell As Range
    > > > For Each cell In Range("c1:j1")
    > > > If cell.Value <> "AAA" Then
    > > > cell.EntireColumn.Hidden = True
    > > > End If
    > > > Next cell
    > > > End Sub
    > > >
    > > >
    > > > --
    > > >
    > > > HTH
    > > >
    > > > RP
    > > > (remove nothere from the email address if mailing direct)
    > > >
    > > >
    > > > "O&O" <albert.ng@oneandonlyresorts.mu> wrote in message
    > > > news:1131527150.656272.205130@z14g2000cwz.googlegroups.com...
    > > > > How can I make this macro work if my cells contain a text e.g AAA
    > > > > instead of 0 & work on Sheet1, Sheet2 & Sheet3
    > > > >
    > > > > Sub Test1()
    > > > > Dim cell As Range
    > > > > For Each cell In Range("c1:j1")
    > > > > If cell.Value <> 0 Then
    > > > > cell.EntireColumn.Hidden = True
    > > > > End If
    > > > > Next cell
    > > > > End Sub
    > > > >
    > > > > Thxs
    > > > >

    > >



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1