Consulting

Results 1 to 4 of 4

Thread: How to hide cells based on values

  1. #1
    VBAX Contributor
    Joined
    Jun 2014
    Posts
    114
    Location

    How to hide cells based on values

    Hello everyone,

    I've got some panic..

    I can write vba scripts but this time I have a very short deadline.
    anyway...

    I have like 100 Excelfiles where the cells that has no yellow (XLnone) background need to be hidden.
    IanOYN3.jpg

    Could someone help me ?

    Thank you in advance

  2. #2
    VBAX Newbie Olly's Avatar
    Joined
    Mar 2016
    Location
    Darlington, UK
    Posts
    2
    Location
    What exactly do you mean, when you sau you want to hide the cells? Do you want to hide the rows, or columns? Do you want to delete the cell contents?
    --
    My excel blog: http://excel.solutions

    ...walking the tightrope between genius and eejit...

  3. #3
    VBAX Contributor
    Joined
    Jun 2014
    Posts
    114
    Location
    Sorry my bad.

    I actually need to update the question.

    I need to loop through all used cells that has backgroundcolor xlNone and change the cells to interior.colorindex=2

  4. #4
    VBAX Newbie Olly's Avatar
    Joined
    Mar 2016
    Location
    Darlington, UK
    Posts
    2
    Location
    If by "used" cells you mean they are not empty, then something like:

    Sub foo()
        Dim c As Range
        For Each c In ActiveSheet.UsedRange
            If Not IsEmpty(c) And c.Interior.ColorIndex = xlNone Then c.Interior.ColorIndex = 2
        Next c
    End Sub
    --
    My excel blog: http://excel.solutions

    ...walking the tightrope between genius and eejit...

Tags for this Thread

Posting Permissions

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