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
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)
xIndex = xIndex - 1
xVal = xVal & xSplitStr & xArr(xIndex)
Loop While xIndex > 0
xCell.Value = xVal
Application.ScreenUpdating = True
3. Press F5 key, a dialog pops out to remind you select a range to work.
4. Click OK.
Reverse string by a separator with Reverse Text Order
If you have Kutools for Excel, the Reverse Text Order feature can help you to reverse a string as you need.
Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
More than 300 powerful features. Supports Office/Excel
2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features
30-day free trial. 60-day money back guarantee.