Can anyone suggest how can I write a script in VBA that has:data:dog (white)dog (brown)catrabbitand my desired output based on the data is like:dog,cat,rabbit
To write this macro you will need a "for next" loop to step through the cellsWithin this macro you will need to set a variable equal to the contents of thecell.You then need to use the left function to extract the part of the cell beforethe (But then check whether the value is the same as the previous value.If it is not the same concatenate the value to the string you are building.X equals X & myValueHave a go at this and let us know if you have any problems.