- If InStr(Cells(i,"G"),"A-1-1")>0 Then
- Cells(i,"G").offset(0, 1)="头部"
- Cells(i,"G").offset(0, 2)="1/2位置'
- Cells(i,"G").offset(0, 3)="-20℃'
- Elself InStr(Cells(i,"G),"A-1-2") >0 Then
- Cells(i,"G").offset(0, 1)="头部"
- Cells(i,"G").offset(0, 2)="1/2位置'
- Cells(i,"G").offset(0, 3)="-84℃'
- Elself InStr(Cells(i,"G),"A-2-1") >0 Then
- Cells(i,"G").offset(0,1)="头部"
- Cells(i,"G").offset(0, 2)="1/4位置'
- Cells(i,"G").offset(0, 2)="-20℃'
- Elself InStr(Cells(i,"G),"A-2-2") >0 Then
- Cells(i,"G").offset(0,1)="头部"
- Cells(i,"G").offset(0, 2)="1/4位置'
- Cells(i,"G").offset(0, 2)="-84℃'
- Elself InStr(Cells(i,"G),"A-3-1") >0 Then
- Cells(i,"G").offset(0,1)="头部"
- Cells(i,"G").offset(0, 2)="表面'
- Cells(i,"G").offset(0, 2)="-20℃'
- Elself InStr(Cells(i,"G),"A-3-2") >0 Then
- Cells(i,"G").offset(0,1)="头部"
- Cells(i,"G").offset(0, 2)="表面'
- Cells(i,"G").offset(0, 2)="-84℃'
- Elself InStr(Cells(i,"G),"B-1-2") >0 Then
- Cells(i,"G").offset(0, 1)="尾部"
- Cells(i,"G").offset(0, 2)="1/2位置'
- Cells(i,"G").offset(0, 3)="-20℃'
- Elself InStr(Cells(i,"G),"B-1-2") >0 Then
- Cells(i,"G").offset(0, 1)="尾部"
- Cells(i,"G").offset(0, 2)="1/2位置'
- Cells(i,"G").offset(0, 3)="-84℃'
- Elself InStr(Cells(i,"G),"B-2-1") >0 Then
- Cells(i,"G").offset(0,1)="尾部"
- Cells(i,"G").offset(0, 2)="1/4位置'
- Cells(i,"G").offset(0, 2)="-20℃'
- Elself InStr(Cells(i,"G),"B-2-2") >0 Then
- Cells(i,"G").offset(0,1)="尾部"
- Cells(i,"G").offset(0, 2)="1/4位置'
- Cells(i,"G").offset(0, 2)="-84℃'
- Elself InStr(Cells(i,"G),"B-3-1") >0 Then
- Cells(i,"G").offset(0,1)="尾部"
- Cells(i,"G").offset(0, 2)="表面'
- Cells(i,"G").offset(0, 2)="-20℃'
- Elself InStr(Cells(i,"G),"B-3-2") >0 Then
- Cells(i,"G").offset(0,1)="尾部"
- Cells(i,"G").offset(0, 2)="表面'
- Cells(i,"G").offset(0, 2)="-84℃'
- Elself InStr(Cells(i,"G),"A-1") >0 Then
- Cells(i,"G").offset(0,1)="头部"
- Cells(i,"G").offset(0, 2)=""
- Cells(i,"G").offset(0, 2)="-20℃'
- Elself InStr(Cells(i,"G),"A-2") >0 Then
- Cells(i,"G").offset(0,1)="头部"
- Cells(i,"G").offset(0, 2)=" "
- Cells(i,"G").offset(0, 2)="-84℃'
- Elself InStr(Cells(i,"G),"B-1") >0 Then
- Cells(i,"G").offset(0,1)="尾部"
- Cells(i,"G").offset(0, 2)=" "
- Cells(i,"G").offset(0, 2)="-20℃'
- Elself InStr(Cells(i,"G),"B-2") >0 Then
- Cells(i,"G").offset(0,1)="尾部"
- Cells(i,"G").offset(0, 2)=" "
- Cells(i,"G").offset(0, 2)="-84℃'
- end if
复制代码 类似这样的多个if语句还能优化吗?请大神赐教。
office版本是2010,最新的函数或者语法可能会没法用。
目前这样写,能满足我日常的工作。 
|