• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Code for selecting data points for a chart

Krishna20

New Member
Hi,

I have written a code to select data points for a bar chart. I have a number attached in cell C3 and whenever i run the code, there is no effect on the chart. I have attached the file. Please help me.

Thanks
Krishna
 

Attachments

Hi Kris

Your description is not helping you as much as it could. You need to say what you are trying to do. Your code does not help a lot. If I were to guess I would say you want to chart the columns which have true. But I could be wrong. If this is correct you will want to just hide the cells with False. This will exclude them from the graph. Then have a procedure which unhides all so you can hide a new set of columns. Here is my take on what I think you are trying to do.

Code:
Sub Hideit()
Dim rng As Range
    For Each rng In Range("D3", Range("IV3").End(xlToLeft))
        rng.EntireColumn.Hidden = (rng = False)
    Next rng
End Sub

'The following will undo what you have just done.
Sub Unhide()
  Range("D3", Range("IV3").End(xlToLeft)).EntireColumn.Hidden = False
End Sub


Explain in detail what you want and perhaps have a chart looking like you want after the procedure has run. That will give you the best answer.

Take care

Smallman
 
Last edited:
Back
Top