Splitting numbers and custom format text values using VBA
Hello,
I tried the below code for splitting numbers and custom format text values. However I want to replace the custom text values with the standard names like
gms for GMS
Kilograms for KGS
ton for TON
numbers for NOS
2.I made a mistake with the clearcontents part as the code is clearing the headers also
According to your attachment your VBA procedures revamped :
PHP Code:
Sub Clearall() [H1].CurrentRegion.Offset(1).ClearContents End Sub
Sub Splitmou() Dim V, W, R&, X, Y V = [A1].CurrentRegion.Resize(, 3).Value2: V(1, 3) = "UNIT" W = [M5].CurrentRegion.Columns(2).Value2 Clearall For R = 2 To UBound(V) X = Split(Cells(R, 2).Text) If UBound(X) = 1 Then Y = Application.Match(Left(X(1), 1) & "*", W, 0) If IsError(Y) Then V(R, 3) = X(1) Else V(R, 3) = W(Y, 1) Else V(R, 3) = "?" End If Next [H1:J1].Resize(R - 1).Value2 = V End Sub
► Do you like it ? ► ► So thanks to click on bottom left star icon « ★ Add Reputation » ! ◄ ◄
Bookmarks