Reverse Text Function using Macros (VBA) in Excel Office 365!!
Tags: reversetextfunctionu, vbamacros
Published: 2021-02-09 09:44:54

---
title: Reverse Text Function using Macros (VBA) in Excel Office 365!!
published: true
date: 2021-02-05 05:32:36 UTC
tags: ReverseTextFunctionu,VBAMacros
canonical_url: https://geekexcel.com/reverse-text-function-using-macros-vba-in-excel-office-365/
---

To [reverse text string](https://geekexcel.com/reverse-text-string-or-words-order-in-excel-office-365/) in an Excel worksheet, you may use functions or other options. But if you want to [print](https://geekexcel.com/excel-office-365-print-options-simple-quick-steps-to-print/) your data backward using Macros and [VBA](https://geekexcel.com/excel-office-365-vba-overview-definition-and-examples/), then it will be the easiest way. In this post, we will show you the clear-cut instructions to know **Reverse Text Function using Macros in Excel Office 365**.

## Reverse Text Function using Macros:

Kindly, follow the below instructions to reverse text strings in the worksheet.

- The below screenshot has shown the example text strings in a range **B2:B6**.

![Input range](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/02/EXCEL_eEOuO3WjRc.png)<figcaption id="caption-attachment-21669">Input range</figcaption>

- On the **Developer Tab, select** the **Visual Basic** option under the **Code** section.

![Select Visual Basic option](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2020/09/Select-Visual-Basic-option-4.png)<figcaption id="caption-attachment-14755">Select the Visual Basic option</figcaption>

- Then you need to copy and paste the code given below.

VBA code to reverse text using Macros

Public Function ReverseText(ByVal cell As Range) As String

‘Reverse text using this function

ReverseText = VBA.strReverse(cell.Value)

End Function

‘Ensure that you have a selection

Sub ReverseTextInSelection()

Dim range As Range

Selection.Value= Selection.Value

For Each range In Selection

‘Call the function

range= ReverseText(range)

Next range

End Sub

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

![Save the code](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/02/EXCEL_UydyYsa36Y.png)<figcaption id="caption-attachment-21670">Save the code</figcaption>

- You have to open the sheet containing the data. On the **Developer Tab, choose** the **Macros option** in the **Code** section.

![Choose the Macros option](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2020/09/Choose-the-Macros-option-2.png)<figcaption id="caption-attachment-14747">Choose the Macros option</figcaption>

- You need to make sure that your macro is selected and **click** the **Run** button.

![Click Run option](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/02/EXCEL_ei7NHrR2xQ.png)<figcaption id="caption-attachment-21671">Click Run option</figcaption>

- At last, you will see that all your input text strings are get reversed as shown in the below image.

![Output](https://eadn-wc04-371788.nxedge.io/cdn/wp-content/uploads/2021/02/EXCEL_elm8qZc1Zv.png)<figcaption id="caption-attachment-21672">Output</figcaption>

## Bottom-Line:

In this post, you can easily understand the clear-cut instructions to know **Reverse Text Function using Macros in Excel Office 365**. Give your **suggestions/feedback** in the below comment section. Thanks for visiting **[Geek Excel.](https://geekexcel.com/)** Keep Learning!

#### Read Ahead:

- [Resize All Charts using Macros (VBA) in Excel Office 365!!](https://geekexcel.com/resize-all-charts-using-macros-vba-in-excel-office-365/)
- [Convert Chart into Image using Macros (VBA) in Excel Office 365!!](https://geekexcel.com/convert-chart-into-image-using-macros-vba-in-excel-office-365/)
- [Create a Table of Contents using Macros (VBA) in Excel Office 365!](https://geekexcel.com/create-a-table-of-contents-using-macros-vba-in-excel-office-365/)