Livin404
Well-known Member
- Joined
- Jan 7, 2019
- Messages
- 743
- Office Version
- 365
- 2019
- Platform
- Windows
Greetings I have a Macro and it works, but I think I can streamline it. The following is my Macro.
The line I think I can reduce is
I only need Cell "K8".
Thank you,
VBA Code:
Sub Domestic_Msn()
Dim r As Long, Data As Variant, Result As Variant
Data = Range("K8", Cells(Rows.Count, "K").End(xlUp)).Value
Result = Range("H8").Resize(UBound(Data)).Value
For r = 1 To UBound(Data)
If Data(r, 1) Like "[ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789][BJKLQV][ABCPEQJRUWYZ]*" Then
Result(r, 1) = Result(r, 1) & Mid("/DOMESTIC MSN", 1 - (Result(r, 1) = ""))
End If
Next
Range("H8").Resize(UBound(Result)) = Result
End Sub
The line I think I can reduce is
Excel Formula:
Data = Range("K8", Cells(Rows.Count, "K").End(xlUp)).Value
I only need Cell "K8".
Thank you,