excel vba 取一个单元格2个字符之间的内容

vba 在excel一个单元格里面有如以下的输入格式:如果cells(1,1)里面的值为:1234,abc,ded,www如何通过vba在让另一个单元格cells(1,2)的内容等于第2个逗号和第3个逗号之间的内容,即ded
最新回答
鹿无戥

2024-11-04 04:21:31

cells(2,1)=mid(cells(1,1),instr(instr(1,cells(1,1),",")+1,cells(1,1),",")+1,instr(instr(instr(1,cells(1,1),",")+1,cells(1,1),",")+1,cells(1,1),",")-instr(instr(1,cells(1,1),",")+1,cells(1,1),",")-1)

也可以参照楼上的
X=split(cells(1,1),",")
cells(2,1)=X(2)
陪你到世界的终结

2024-11-04 07:42:56

X=split(cells(1,1),",")
MsgBox X(2)
X = Nothing