|
xyh2732 发表于 2013-4-24 09:14
非常感谢您的帮忙,我添加了一些前面没有英文名称的 就出错了(比如 12030001.TIF ),请帮忙看看有没有办 ... - Sub aa()
- Dim i%, x%
- For i = 2 To [A65536].End(3).Row
- x = Right(Split(Cells(i, 1), ".")(0), 4)
- Do Until Left(Right(Split(Cells(i, 1), ".")(0), 8), 4) <> Left(Right(Split(Cells(i + 1, 1), ".")(0), 8), 4)
- If Right(Split(Cells(i, 1), ".")(0), 4) <> x Then
- Do Until Right(Split(Cells(i, 1), ".")(0), 4) = x
- Range("C" & [C65536].End(3).Row + 1) = Left(Cells(i, 1), Len(Split(Cells(i, 1), ".")(0)) - 4) & Format(x, "0000")
- x = x + 1
- Loop
- End If
- i = i + 1
- x = x + 1
- If i = [A65536].End(3).Row Then Exit For
- Loop
- Next
- End Sub
复制代码 |
|