splitting a string
just in addition to gary's student's code, it code also be done like this:
v = Range("A1").Value
Range("A2").Value = Split(v, "/")(0)
Range("A3").Value = Split(v, "/")(1)
--
Gary
"roc616" wrote in message
...
I'm new to VBA and running into problem on what is probably a very simple
task. Any help would be greatly appreciated.
I have information in a cell like this: 4.5/FNCL 5.
I need to copy the information before the / to another cell, and the
information after the / to a different cell.
This is what I have been doing:
dim coupon
dim collat
coupon = Mid(Sheets("temp").Cells(row, 5).Value, 1, Find("/",
Sheets("temp").Cells(row, 5).Value, 1) - 1)
collat = Mid(Sheets("temp").Cells(row, 5).Value, Find("/",
Sheets("temp").Cells(row, 5).Value, 1) + 1, Len(Sheets("temp").Cells(row,
5).Value))
the formula using mid and find works when i put in a cell in excel, but it's
not working in the VBA. when i click debug, it highlights the word "find"
saying it doesn't recognize the function. Does anyone know a different way
of doing it or what could be wrong?
Thank you.
|