+ Reply to Thread
Results 1 to 4 of 4

Conditional Expression

  1. #1
    Registered User
    Join Date
    12-15-2006
    Posts
    10

    Conditional Expression

    In a macro I need to hide a number of rows in a worksheet if the content of a cell is "Purchasing". If it is true, hide the rows, if not skip the hide and go to the next command but stay in the macro. Can anyone help me? My VB is very weak.

    Thanks
    Ed

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Response

    Something like

    Sub Test()
    If Range("A1") = "Purchasing" Then
    Rows("2:5").RowHeight = 0
    End If

    'Other macro code goes here
    End Sub
    Martin

  3. #3
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    I assume you want every occurrence of Purchasing in a range to hide the row.

    Try this

    Please Login or Register  to view this content.
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  4. #4
    Registered User
    Join Date
    12-15-2006
    Posts
    10
    Thank you very much. I'm sure I can make one of these work.

    Ed

+ 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