Selecting cells *dynamic range*

dusty

Registered User.
Local time
Yesterday, 18:26
Joined
Aug 20, 2009
Messages
42
I have a Column which is a long list of tools. The column is seperated into groups by headings.

e.g. cell C1 is the heading "Concept" which is bold outlined and has a grey background. Beneath this in cells C2 to Cx is a list of tools relevant to the concept phase.

Cell Cx+1 has another heading "Basic Design" all heading cells are formated the same. Beneath this cell is a list of all the tools relevant to this phase.

And so on in total there are 7 phases.

What I want to be able to do is start from one heading cell and then cycle through each row until the next heading cell is reached.

In the column to the right of each tool there will be an x in the cell or nothing. if an x is present the row remains visible if an x is not present the row will be hidden.

I have this code working for a set range.

For Each c In Worksheets("Master Table").range("E10:E16").Cells

If c.Value <> "x" Then

c.EntireRow.RowHeight = 0

Else
c.EntireRow.RowHeight = 13.8
End If

Next c

But the problem is the list can grow so the range can not be set. Which is why i need to be able to start from one heading and run the code until the next heading is reached.

Any help would be great I hope I explained it clearly

Dusty.
 
Ive sorted it :)

I used the define name option and selected the range.

When rows are added the range automatically expands.

Then I can select the range within vb by its name rather than cell references.
 
research "current region" this will dynamicaly select a range... depending on how much data there actually is.
 

Users who are viewing this thread

Back
Top Bottom