Thread
:
splitting a string
View Single Post
#
3
Posted to microsoft.public.excel.programming
Don Guillett
external usenet poster
Posts: 10,124
splitting a string
Look in the vba help index for
INSTR
Sub splittext()'this is the idea
With Cells(2, "J")
x = InStr(.Value, "/")
lp = Left(.Value, x - 1)
MsgBox lp
rp = Mid(.Value, x + 1, 33)
MsgBox rp
End With
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"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.
Reply With Quote
Don Guillett
View Public Profile
Find all posts by Don Guillett