How To use Delimiting the text in a cell to column vertically in VBA?
Tags: tousedelimitingthete, vbamacros
Published: 2021-09-28 04:31:10

---
title: How To use Delimiting the text in a cell to column vertically in VBA?
published: true
date: 2021-09-23 11:57:22 UTC
tags: ToUseDelimitingTheTe,VBAMacros
canonical_url: https://geekexcel.com/how-to-use-delimiting-the-text-in-a-cell-to-column-vertically-in-vba/
---

In this article, you will learn how to **use delimiting the text in a cell to column vertically** in VBA. Let’s see them below!! Get the official version of  **MS Excel**  from the following link: [https://www.microsoft.com/en-in/microsoft-365/excel](https://www.microsoft.com/en-in/microsoft-365/excel)

## Example

- Firstly, you need to **type URL as sample text in cell A10**.

![](https://geekexcel.com/wp-content/uploads/2021/09/Sample-data-38.png)<figcaption>Sample URL</figcaption>

- In the Excel Worksheet, you have to go to the  **Developer Tab.**
- Then, you need to ** ** select the  **Visual Basic**  option under the  **Code**  section.

![Select Visual Basic](https://geekexcel.com/wp-content/uploads/2021/09/Select-Visual-Basic-9-1024x180.png)<figcaption>Select Visual Basic</figcaption>

- Now, you have to  **copy and paste the code**  given below.

```
Sub texttocolumns()

'Declaring variables
Dim StartRow, i, LastCol As Long
Dim Rng As Range

'disabling the display alerts
Application.DisplayAlerts = False

'Initializing the variable
StartRow = 10
Set Rng = Range("A10")

'Separting the text based on the delimiter
Rng.texttocolumns Destination:=Rng.Offset(0, 1), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Other:=True, OtherChar _
    :="-"

'Finding the column number of cell containing the last string after delimiting
LastCol = Rng.End(xlToRight).Column

'arranging the text in columns to rows
For i = 2 To LastCol
    Cells(10, i).Cut Cells(StartRow, 2)
    StartRow = StartRow + 1
Next i
End Sub

```

- You need to  **save the code**  by selecting it and then  **close the window**.

![](https://geekexcel.com/wp-content/uploads/2021/09/Save-the-Code-76-1024x668.png)<figcaption>Save the Code</figcaption>

- Again, you have to go to the  **Excel Spreadsheet** , and click on the  **Developer Tab**.
- You need to choose the  **Macros option**  in the Code section.

![Choose Macro option](https://geekexcel.com/wp-content/uploads/2021/09/Choose-Macro-option-11-1024x184.png)<figcaption>Choose Macro option</figcaption>

- Then, you have to make sure that your  **macro name is selected**  and click the  **Run ** button.

![](https://geekexcel.com/wp-content/uploads/2021/09/Run-the-Code-46.png)<figcaption>Run the Code</figcaption>

- Finally, this time, you will get **return output** in the **next column** and the **text value in the cell** is separated to **multiple sub strings in multiple cells** in the **second column**.

![](https://geekexcel.com/wp-content/uploads/2021/09/Output-37.png)<figcaption>Output</figcaption>

## Conclusion

We hope that this short tutorial gives you guidelines on how to **use delimiting the text in a cell to column vertically** in VBA. Please leave a comment in case of any  **queries,**  and don’t forget to mention your valuable  **suggestions**  as well. Thank you so much for Visiting Our Site!! Continue learning on **[Geek Excel](https://geekexcel.com/)!! **Read more on [**Excel Formulas**](https://geekexcel.com/excel-formula/) **!!**

**Continue Reading:**

- **[Excel Formulas to Remove the Text By Variable Position ~ Quickly!!](https://geekexcel.com/excel-formulas-to-remove-the-text-by-variable-position/)**
- **[Excel Formulas to Get the Maximum Value with Variable Columns!!](https://geekexcel.com/excel-formulas-maximum-value-with-variable-columns/)**
- **[Formulas to Count Variable Range with COUNTIFS Function!!](https://geekexcel.com/excel-formulas-to-count-variable-range-with-countifs-function/)**
- **[Excel Office 365 VBA Variables & Data Types – A Complete Guide!!](https://geekexcel.com/excel-office-365-vba-variables-data-types-a-complete-guide/)**
- **[How to use the CONFIDENCE.NORM function in Excel office 365?](https://geekexcel.com/how-to-use-the-confidence-norm-function-in-excel-office-365/)**