Google Sheets, on a comma Keyup event perform CTRL+Enter in a cell

Viewed 68

I have a Call Log spreadsheet I'm trying to keep as simple as possible for those not so friendly with computers and technology. Sometimes we get people calling with more then one thing to look for. Instead of using row after row for each item, or asking people to remember what the CTRL+Enter does I'd like to have a keyup event on a comma to perform a CTRL+Enter line break in the cell(s) which are all Word Warped, whenever it is detected. Is that even possible?

I am a complete noob when it comes to scripts, and functions. Found scripts for keyup on the ASCII for a comma, but nothing on for a line break. Hoping someone can help me.

1 Answers

Unfortunately, that is a no.

According to the Sheets macro manifest resource, a default macro's shortcut must be of the form Ctrl+Alt+Shift+Number where Number is a single digit number. Hence, placing a macro on the comma button is not possible.

Alternative Solution

You can use a function with an onEdit(e) simple trigger just like the one below:

function onEdit(e) {
  var range = e.range;
  range.createTextFinder(",").replaceAllWith("\n");
}

This function will basically find all commas in the cell and will be replaced with a new line.

Output

Sample

NOTE: This alternate solution will convert all commas into "next line".

References

For further details, you may visit the following resources:

Related