Monday 19 October 2015

VBA split function example

Sub Split_1()

Dim name As String
Dim Split_name() As String ' Array String

name = InputBox("Enter your name: ")

Split_name = Split(name) ' Split function used - by default this is with space
   
Range("a1").Value = Split_name(0)  'stored value before space
Range("b1").Value = Split_name(1) ' stored value after space

End Sub

 

No comments:

Post a Comment