Mat*_*ill 2 excel vba excel-vba
例如,如果我有:
Sub TestModule()
Dim test As String
test = "Machine Head"
End Sub
Run Code Online (Sandbox Code Playgroud)
如何提取单词Machine并将其分配给变量?我尝试过使用Search和Left功能,但没有取得多大成功.
干杯!
使用Split():
Sub TestModule()
Dim test As String
dim frstWrd as string
test = "Machine Head"
frstWrd = split(test," ")(0)
Debug.Print frstWrd
End Sub
Run Code Online (Sandbox Code Playgroud)