How to reverse domain name by notation in Excel?
Sometimes, you may encounter a job on reversing the domain name by notation as below screenshot shown, do you have any tricks to quickly solve it? In this article, I introduce two methods to quickly handle it.
Here is a macro code that can help you, please do as follow in Excel:
1. Press Alt + F11 keys to enable the Microsoft Visual Basic for Applications window.
2. Click Insert > Module, copy and paste the code to the blank script.
VBA: Reverse domain name by notation
Sub Reverse() 'UpdatebyExtendoffice2017115 Dim xArr() As String Dim xSplitStr As String Dim xVal As String Dim xRg As Range Dim xCell As Range Dim xIndex As Long On Error Resume Next Set xRg = Application.InputBox("Select cells:", "KuTools For Excel", Selection.Address, , , , , 8) If xRg Is Nothing Then Exit Sub Application.ScreenUpdating = False xSplitStr = "." For Each xCell In xRg If InStr(xCell.Value, xSplitStr) = 0 Then GoTo xBreak xVal = "" xArr = Split(xCell.Value, xSplitStr) xIndex = UBound(xArr) xVal = xArr(xIndex) Do xIndex = xIndex - 1 xVal = xVal & xSplitStr & xArr(xIndex) Loop While xIndex > 0 xCell.Value = xVal xBreak: Next Application.ScreenUpdating = True End Sub
3. Press F5 key, a dialog pops out to remind you select a range to work.
4. Click OK.
If you have Kutools for Excel, the Reverse Text Order feature can help you to reverse a string as you need.
|Kutools for Excel, with more than 120 handy functions, makes your jobs easier.|
After installing Kutools for Excel, please do as below: （Free Download Kutools for Excel Now!)
1. Select the string you use, click Kutools > Text > Reverse Text Order.
2. In the Reverse Text dialog, select one option you need to reverse text based on.
3. Click Ok, and the text strings have been reversed.