vba從左邊截取字符串 VBA編程:字符串定位后截???
VBA編程:字符串定位后截???Find the position of the first space=Find(”,A1)提取第一個空格后面的字符串=mid(A1,F(xiàn)ind(”,A1)1,len(A
VBA編程:字符串定位后截???
Find the position of the first space=Find(”,A1)提取第一個空格后面的字符串=mid(A1,F(xiàn)ind(”,A1)1,len(A1))使用VBA提取代碼如下子提取第一個空格后面的字符串()dim T1 as string dim I as long T1=range(“A1”)。值I=instr(T1,”)“查找第一個空格范圍的位置(”B1“)=mid(T1,I 1,len(T1))”將第一個空格后的字符串提取到單元格B1 end sub。如果原始數(shù)據(jù)中沒有空格,則將提取所有字符串。如果是一列數(shù)據(jù),添加一個循環(huán)來做,如果數(shù)據(jù)量大,建議使用數(shù)組來完成,這樣可以提高運(yùn)行速度