tags:

views:

36

answers:

1
+2  Q: 

Excel Macros...

I need to write an excel macro so that in the range of(a:a) if there any value as Closed then the entire row should be hidden. How to do so...

+1  A: 

I can't tell you exactly how to do it since I do not know what is a closed cell, but let met give you some tip on how to find it.

When I want to do something in a programmed excel macro and I don't know the code, I create a record macro and then analyse the code. In your case, what I would do is I would record a macro in which I close a cell (and unclose it to check what happen in both case), then I would select a row and hide it. It can be the row in which the cell is closed. Stop the macro, and examine the code. It will be in sequential order so it's usually fairly easy to pinpoint the line of code you need.

The pseudo-Excel code should look like this

For row = 1 to MaxRow
   For col = 1 to MaxCol
       If Cells(row,col).IsClosed Then 'Replace with the code that the macro use to check if closed
           Rows(row).Hide 'Replace with the code that the macro uses to hide the row
       End If
   Next col
Next row

Hopes that help.

Edit : If it has something to do with a string value (like when it's written close), then you define a range and check its value (Ex : Range("A1").Value should gives you the value of cell A1

David Brunelle