PDA

View Full Version : Solved: multiple Regular expressions on one cell to extract to new cells



lewgoofy
09-15-2011, 01:43 PM
I need to create a macro that will use my funtion to rxget to parse a colum and insert into a new column. I normally place this "=RXGET("^[0-9]{1,2}",D2)" inside the column and a different ""=RXGET" inside the next column and so on to pull the contents apart form one column D2. This is done manually, I would like to have a macro do this for me, instead of doing each column manually. I am not sure how to setup the macro to do this, so that is loops through the data column and pulls the data out and then goes to the next row and does it again until it finds an empty row.

Thanks, Steve

Bob Phillips
09-15-2011, 05:01 PM
Lastrow = Cells(Rows.Counr,"D").End(xlUp).Row
Range("E2").Resize(Lastrow - 1).Formula = "=RXGET(""^[0-9]{1,2}"",D2)"
'etc.

lewgoofy
09-16-2011, 06:23 AM
Lastrow = Cells(Rows.Counr,"D").End(xlUp).Row
Range("E2").Resize(Lastrow - 1).Formula = "=RXGET(""^[0-9]{1,2}"",D2)"
'etc.


This looks good, can you give me a little more, I am new at macro, so I need some structure to get going, then I can add the additional formula's,
thanks again.
Steve

Is there a good vba book you could also recomend.

lewgoofy
09-16-2011, 07:49 AM
This looks good, can you give me a little more, I am new at macro, so I need some structure to get going, then I can add the additional formula's,
thanks again.
Steve

Is there a good vba book you could also recomend.

I may need to add that I am trying to use the function RXGET.

I guess I want to know how to call the function and use the formula inside the sub or do I put the function inside the sub, I can not find how to use a function within a macro.

Thanks for any help.
Steve