MsgBox "You can't select multiple columns",, "Kutools for Excel" Set xRg = Application.InputBox("Please select a range", "Kutools for Excel", xAddress,, ,, , 8) VBA code: Split comma separated values into rows Sub SplitAll()
#Excel split cells on comma code#
Then copy and paste the below VBA code into the Module window.
In the Microsoft Visual Basic for Applications window, click Insert > Module. Press the Alt + F11 keys simultaneously to open the Microsoft Visual Basic for Applications window.Ģ. Download Kutools for Excel now! ( 30-day free trail)įor splitting comma separated values into rows, you can apply the following VBA code.ġ. Here the Kutools for Excel's Split Cells utility can help you quickly split cells by space, comma, new line, other separators or certain width into not only separated rows, but columns in Excel. Normally, the Text to columns feature only splits cells into separate columns, if you want to split cells into rows, how can you do? Now all the values in selected cells which were separated by commas are split to different columns as bellow screenshot shown. In the last Convert Text to Columns Wizard dialog box, select a cell for locating the splitting values in the Destination box, and finally click the Finish button. In the second Convert Text to Columns Wizard dialog box, only check the Comma box in the Delimiters section, and click the Next button.Ĥ. In the first Convert Text to Columns Wizard dialog box, select the Delimited option, and then click the Next button.ģ. Select the range of cells you want to split values into columns, and then click Data > Text to Columns. You can apply the Text to Columns function to split comma separated values of selected cells into columns. Quickly split comma separated values into rows or columns with Kutools for Excel Split comma separated values into rows with VBA code Split comma separated values into columns with Text to Columns function Here we will introduce three methods for you to solve this problem in details. In some cases, you may need to split comma separated values of selected cells into rows or columns.
#Excel split cells on comma how to#
How to split comma separated values into rows or columns in Excel?