Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How can I replace commas with a line feed in a single cell? I am building an imp

ID: 638588 • Letter: H

Question

How can I replace commas with a line feed in a single cell?

I am building an import spreadsheet to go into a particular database. The database vendor has a very specific format that the table must be in to work. Here's where I'm having trouble

On a given row, some of the fields contain multiple items, separated by commas. In order for the import to work, these items need to be separated by a line-feed within the cell, instead of a comma. I've tried to illustrate this below....   Any ideas on how to do some kind of find-and-replace that would change the commas to line feeds?

What the table looks like now:

What it needs to look like:

Thanks for help !!

ID Name Age Keyword 1 Apple Pediatric Red,White,Blue 2 Banana Adult,Teen Blue,Green,Purple,Brown 3 Grape Pediatric,Teen Black,White

Explanation / Answer

Hi....

use the following macro:.

Sub ReplaceComma()
Dim rngCell As Range
For Each rngCell In Selection
    rngCell.Value = Replace(rngCell, ",", vbLf)
Next
End Sub

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote