adding a line break after ***, extension

exceled

New Member
Joined
Oct 18, 2011
Messages
8
Hi everyone... first question, go steady on me!!

I want to add a line break to separate files in one cell

Example:

testfile.doc,second testfile.pdf,third,testfile.doc

Result:

testfile.doc
second testfile.pdf
third,testfile.doc

all within the same cell, any ideas?
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Thanks for your help, however thats the best I came up with.

If the file name has a comma in it, it doesn't work:

For example

123 34, 123, 34, 34 - test.doc becomes

123 34
123
34
34 - test.doc

which isn't great
 
Upvote 0
Thanks for your help, however thats the best I came up with.

If the file name has a comma in it, it doesn't work:
The problem is you picked a bad character (the comma) to use as a delimiter because it is a valid character in file name. Why don't you use, say, an asterisk or maybe a question mark (wildcard symbols are not allowed in a filename) as your delimiter.
 
Upvote 0
Do you know what all of the possible extensions for your filenames could be? If so, can you post a list of them for us? If not, can you assure us that none of the filenames have dots in them (except for the one in front of the extension, that is)?
 
Upvote 0
the only file name extensions are:
.doc
.ppt
.PDF (.pdf)
.TIF
.docx
Does this UDF do what you want?

Code:
Function CreateLF(S As String) As String
  Dim X As Long, V As Variant, Extensions() As String
  Extensions = Split(".doc .ppt .pdf .tif .docx")
  CreateLF = S
  For Each V In Extensions
    CreateLF = Replace(CreateLF, V & ",", V & vbLf, , , vbTextCompare)
  Next
  Do While InStr(CreateLF, vbLf & " ")
    CreateLF = Replace(CreateLF, vbLf & " ", vbLf)
  Loop
End Function
Note: Don't forget to format the cells you put this formula in to "Wrap text" (Alignment tab of the Format Cells dialog box).
.
 
Upvote 0

Forum statistics

Threads
1,224,315
Messages
6,177,842
Members
452,809
Latest member
mar_luna

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top