How to write multiple lines (to simulate Alt+ enter that adds a new line) inside a single cell in Excel?
There are two approaches by which a new line can be added while passing content into a single cell. These approaches are explained below:
Approach #1: Use of the hotkey activity - this approach is more efficient only if this needs to be done on less number of cells. Otherwise, clicking on multiple cells and sending hotkey might not be an optimal solution.
- Select the cell into which data needs to be entered
- Send Hot key F2 (to go to formula bar for the selected cell)
- Type into the first line (Selector of the forumula bar)
- Send hotkey Alt+Enter (Selector of the forumula bar)
- Type into the Send line (Selector of the forumula bar)
- Send hot key (Enter Selector of the forumula bar)
Approach #2: Use the new line character - This approach is explained as follows.
- Have a workflow with Read Cell and write cell with arguments for the cells and the text
- The write cell activity should incorporate the "Environment.NewLine" attribute that helps in creating the new line inside the cell, as shown in the screenshot below
- Call this workflow in the iteration building a logic around to find the right cell
- If there are several iterations, keep appending the new line character to a variable (say Column1). At the end of the loop write into the respective cells.