How To Separate Website Name or URL from Text in Microsoft Excel?
Tags: toseparatewebsitenam, vbamacros
Published: 2021-10-22 09:27:54

---
title: How To Separate Website Name or URL from Text in Microsoft Excel?
published: true
date: 2021-10-21 07:49:21 UTC
tags: ToSeparateWebsiteNam,VBAMacros
canonical_url: https://geekexcel.com/how-to-separate-website-name-or-url-from-text-in-microsoft-excel/
---

In this tutorial, we will guide you on how to ** separate website names**  **or URLs from text using VBA ** in Microsoft Excel. Let’s get them below!! Get an 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)**

## Separate the name

- Firstly, you need to **create a sample data** in Excel.

![](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/10/Sample-data-35.png)<figcaption>Sample data</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://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/09/Select-Visual-Basic-9-1024x180.png)<figcaption>Select Visual Basic</figcaption>

- Now, you have to **select the Column** and go to **replace** option under **Edit**.

![](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/10/Click-on-Replace.png)<figcaption>Click on Replace option</figcaption>

- After that, you need to **replace http: with (spaces)**.
- Finally, you will find that the names get **separated to a distance**.

## Separate web name from the text

- Firstly, in the Excel Worksheet, you have to go to **Text to column** option under **Data**.

![](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/10/Go-to-Text-to-column-option.png)<figcaption>Go to Text to Columns</figcaption>

- Then, you need to select the **fixed width** option.

![](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/10/Select-the-fixed-width-option.png)<figcaption>Select the fixed width option</figcaption>

- Now, you have to get the **marker to specific location** where in the column before the first **website name** in the whole column.
- After that, you need to click **next,** and you will see that the **text before web names are in black**.

![](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/10/Click-on-Next-Button.png)<figcaption>Click on the Next button</figcaption>

- Finally, you have to click on the **Finish** button, and you will find your **web names separated from the text**.

![](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/10/Click-on-Finish-Button.png)<figcaption>Click on Finish Button</figcaption>

## To make it a Hyper link

- Firstly, 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://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/09/Select-Visual-Basic-9-1024x180.png)<figcaption>Select Visual Basic</figcaption>

- Now, you have to go to **Insert** and then select **Module**.

![Insert a module](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/09/Insert-a-module.png)<figcaption>Insert a module</figcaption>

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

```

Sub MakeHyperlinks_D()
Dim cell As Range, Rng As Range
Set Rng = Range("A1:A" & Cells.Rows.Count). _
SpecialCells(xlConstants, xlTextValues)
If Rng Is Nothing Then
MsgBox "nothing in range"
Exit Sub
End If
For Each cell In Rng
If Trim(cell.Value) <> "" Then
ActiveSheet.Hyperlinks.Add Anchor:=cell, _
Address:=cell.Value, _
ScreenTip:=cell.Value, _
TextToDisplay:=cell.Value
End If
Next cell
End Sub

```

- After that, you need to  **save the code**  by selecting it and then  **close the window**.

![](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/10/Save-the-Code-67.png)<figcaption>Save the Code</figcaption>

- You have to go to **File** and then click on **Close and Exit**.

![](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/10/Click-on-Close-and-Exit.png)<figcaption>Click on Close and Exit</figcaption>

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

![Choose Macro option](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/09/Choose-Macro-option-11-1024x184.png)<figcaption>Choose Macro option</figcaption>

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

![](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/10/Run-the-Code-56.png)<figcaption>Run the Code</figcaption>

- Finally, after running the macro, you will find your **Websites hyperlinked** in Excel.

![](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/10/Output-36.png)<figcaption>Output</figcaption>

## Wrap-Up

We hope that this tutorial gives you guidelines on how to  **separate website names or URLs from text using VBA**  in Microsoft Excel. ** ** 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/) **!!**

**Related Articles:**

- **[How to Insert or Display Images from URLs or File Paths in Excel?](https://geekexcel.com/how-to-insert-or-display-images-from-urls-or-file-paths-in-excel/)**
- **[Excel Formulas to Separate the Decimal Part of a Number!!](https://geekexcel.com/excel-formulas-to-separate-decimal-part/)**
- **[Excel Formulas to Get Page Name from URL ~ Simple Tutorial!!](https://geekexcel.com/excel-formulas-to-get-page-from-url/)**
- **[Formulas to Get Domain Name from URL ~ Simple Tricks!!](https://geekexcel.com/excel-formulas-to-get-domain-name-from-url/)**