Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VBA that will replace line skips with commas

Posted on 2010-08-20
4
Medium Priority
?
432 Views
Last Modified: 2012-05-10
I have a bunch of cells with line skips in them, as shown below only with the square symbol displayed after each number. I need a simple code that will convert all of them to commas followed by a space, as in: 17A, 17K, 18A ... etc.

Thanks,
John




... NO POWER 15H
17A
17K
18A
18C
18G

Open in new window

0
Comment
Question by:gabrielPennyback
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 14

Expert Comment

by:JP
ID: 33487853
I believe you can go to edit and replace and copy the symbol you want to remove and paste it into the find what and replace it with the comma.
0
 
LVL 93

Accepted Solution

by:
Patrick Matthews earned 2000 total points
ID: 33488436
John,A simple formula will do it, assuming you mean ANSI 10 for the "line skip" (that's what Excel uses for an in-cell line break).=SUBSTITUTE(A2,CHAR(10),", ")In code you could use the Replace method, as below.Patrick
ActiveSheet.UsedRange.Replace Chr(10), ", "
 
' note how the Excel function is CHAR while the VBA function is Chr  :)

Open in new window

0
 
LVL 1

Author Comment

by:gabrielPennyback
ID: 33686580
Yes, please award the points to Patrick, his answer works perfectly.
Thanks,
John
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

598 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question