View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
smartin smartin is offline
external usenet poster
 
Posts: 915
Default Parsing a text string in Col. A to extract 2 values and returntheir product in Col. B

u473 wrote:
I need to process to parse a text string in column A to extract 2
values and return their product in colunmn B
A B
120x150 18000

It gets worse when sometimes in the same Col. A I get 2 sets of 2
values like in the following case
40x40x120x120 16000

First I have to test whether I have to deal with the first or second
case
but then I get lost in handling the Instr and InstrRev functions to
extract each set of values
Help appreciated


Try this out:

Sub mult()
Dim c As Range
For Each c In Application.Intersect(Range("A:A"), _
ActiveSheet.UsedRange)
c.Offset(0, 1) = Application.Evaluate(Replace(c.Text, "x", "*"))
Next
End Sub