我想知道如何將 Excel 宏范圍內字串的前 8 個(或任何數字)字符放入變數中。
我有這段代碼,但我不知道如何在這些范圍內獲取一定數量的字符。
sourceBook.Sheets(1).Name = sourceBook.Sheets(1).Range("first_name") & " - " & sourceBook.Sheets(1).Range("last_name")
uj5u.com熱心網友回復:
使用 Left 函式,例如
Public Function func(s As String, n As Integer) As String
'returns the first n characters of a string
func = Left$(s, n)
End Function
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/472658.html
