View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
S Davis S Davis is offline
external usenet poster
 
Posts: 138
Default Insert number of rows based on criteria

On Jan 5, 7:36*pm, "Otto Moehrbach"
wrote:
In your last paragraph, the one where you ask about inserting the name of
the criteria into Column AA, would "Joe" then *have a different criteria
name in Column AA in each of the 3 inserted rows? * Otto"S Davis" wrote in message

...

Hello,


Is there any way to insert a number of rows based on criteria?


Sample data:
A------------S---T---U-....
Bill---------(_)-(X)-(_)
Bob--------(_)-(_)-(_)
Joe---------(X)-(X)-(X)
Murph ....


(Where (_) denotes a blank cell)


Desired presentation:


Bill---------(_)-(X)-(_)
(blank row)
Bob--------(_)-(_)-(_)
Joe---------(X)-(X)-(X)
(blank row)
(blank row)
(blank row)
Murph ....


I have a list of names in column A, and a list of criteria names in S1
- Z1. For each name (ie. Bill), criteria is defined as met with any
marking in that column (ie. T1 = "X", or "o", or anything nonblank)


What I would like to do then is for every row, look at the range S-Z,
count the number of nonblank cells, and then insert that number of
nonblank rows directly underneath. Then move onto the next name until
the list is exhausted.


Ideally, though this may be asking too much, each row that is inserted
should then have the name of the criteria inserted into AA. So, for
instance, in the sample data above, if Bill has an X under column T,
and T1 reads "Car", the data should look like this:


A------------S---T---U-....AA
Bill---------(_)-(X)-(_)
---------------------------....Car
Bob....


Any help and a walkthrough of the code would be so much appreciated!
Thanks


Otto, yes. If S = Car, T= Bike, U = Van, then it would read:

Bill---------(_)-(X)-(_)
(blank row)-----------Bike
Bob--------(_)-(_)-(_)
Joe---------(X)-(X)-(X)
(blank row)-----------Car
(blank row)-----------Bike
(blank row)-----------Van
Murph ....