PDA

View Full Version : Sleeper: Conditionnal copying rows



oleneazer
09-21-2005, 03:25 AM
Hello


I try to do with VBA
In sheet1, column 1
there are N occurences of two strings (str1 and str2)
ex:
a,b,c,d,str1,...,str2,...,e,f,g,str1,...str2,... etc etc

I want to copy in sheet2, column 1 all the ranges beginning by str1 and finishing by str2

I have a solution if there is only on time str1 and str2 in sheet2

Thanks for your help

royUK
09-21-2005, 03:57 AM
It might be easiest to use Advanced Filter, you can automate this with VBA - get the code by using the Macro Recorder.

oleneazer
09-21-2005, 06:02 AM
Hello
Thanks for your help

I can't use Filters for this
because I want to copy the values of the cells betwen str1 and str2
example:
A1:A10: anything
A11= str1
A12:A15= anything
A16=str2

so I want to copy the range A11:A16 in sheet 2
and if there is more occurences of str1 and str2
the code will copy all ranges wich are like
Range("A" & srt1.row:"A" & srt2.row)

I hope what I wrote is clear

(see the attachment file, please
I have a uncomplete solution)