SHARE
TWEET

Post Split

ba5tz Aug 16th, 2019 92 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Function Pisa(inputstr As String) As String
  2.  
  3. Dim i As Long
  4. Dim temp As String
  5.  
  6. If inputstr = vbNullString Then
  7.     splitbycaps = temp
  8.     Exit Function
  9. Else
  10.     temp = inputstr
  11.     For i = 1 To Len(temp)
  12.         If Mid(temp, i, 1) = UCase(Mid(temp, i, 1)) Then
  13.             If i <> 1 Then
  14.                 temp = Left(temp, i - 1) + " " + Right(temp, Len(temp) - i + 1)
  15.                 i = i + 1
  16.             End If
  17.         End If
  18.     Next i
  19.     Pisa = temp
  20. End If
  21. End Function
  22.  
  23. 'regex
  24. Dim xSplit, i As Integer, Besar As Boolean
  25. Dim sTemp As String
  26. Dim Rng As Range, xData As Range
  27. Dim objRegex As Object
  28. Set objRegex = CreateObject("vbscript.regexp")
  29. Set Rng = Sheets(1).Range("A2:A5")
  30. For Each xData In Rng
  31.     With objRegex
  32.     .Global = True
  33.     .Pattern = "([a-z])([A-Z])"
  34.     xSplit = Split(.Replace(xData, "$1 $2"), " ")
  35.     For i = 0 To UBound(xSplit)
  36.         xData.Offset(0, i + 1).Value = xSplit(i)
  37.     Next i
  38. End With
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top