View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default splitting a string

If you have a bunch of these entries in a single column, you could insert a
column to the right and then use:

select the range
Data|text to columns
delimited (by /)

And you'll get the info in different cells really quickly.

You could record a macro when you do it manually if you need the code.

roc616 wrote:

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.


--

Dave Peterson