到目前为止得到了这个vba:
For Each cell In Range("A2", Range("A" & Rows.Count).End(xlUp))
If Len(cell.Value) = 11 Then
cell.Copy Destination:=Range("B" & Rows.Count).End(xlUp).Offset(1, 0)
End If
Next cell
我需要在第二行的“11”后面添加一些代码,但我不知道怎么写。我想要做的是添加类似“
and digit number 8 (of 11) is 1 or 3 or 5 or 7 or 9 then
”的东西。任何人都可以帮助我吗?
最佳答案
尝试这个
For Each cell In Range("A2", Range("A" & Rows.Count).End(xlUp))
If Len(cell.Value) = 11 Then
Select Case Mid(cell.Value, 8, 1)
Case 1, 3, 5, 7, 9
cell.Copy Destination:=Range("B" & Rows.Count).End(xlUp).Offset(1, 0)
End Select
End If
Next cell
关于Excel vba - 如何在单元格中找到第 8 位数字并评估它是否正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50618887/