当前位置:编程学习 > VB >>

Excel中VBA的一个小应用

--------------------编程问答-------------------- 自己顶一顶不要让帖子沉了。。。我还在痛苦等待中。。。 --------------------编程问答-------------------- 看了半天,还是一头雾水……这描述
这到底是干吗用的? --------------------编程问答-------------------- 看晕了+_+     --------------------编程问答-------------------- 没看懂 --------------------编程问答-------------------- 这问题描述的~~~~,楼下的继续猜,看样子期待楼主说清楚木有这个可能了 --------------------编程问答-------------------- --------------------编程问答-------------------- 仅供参考
dim n as integer
dim L as integer

ActiveCell.SpecialCells(xlLastCell).Select
L = ActiveCell.Row
n=1
do
 doevents
 if Range("A" + CStr(n+1)).Value<>Range("B" + CStr(n)).Value+1 then '下一行的A<>B(上一行)+1
  Range("D" + CStr(n+1)).Value=Range("A" + CStr(n+1)).Value-1
  Range("C" + CStr(n+1)).Value=Range("A" + CStr(n+1)).Value+1
 end if
 n=n+1
 if n>L then exit do
loop
--------------------编程问答-------------------- 确实楼主说的有些乱,但是7楼的做法应该是正确的哦 --------------------编程问答--------------------

    l = 2
    For i = 2 To [A10000].End(xlUp).Row
        If Cells(i, 1) - Cells(i - 1, 2) <> 1 Then
            Cells(l, 3) = Cells(i, 1)
            Cells(l - 1, 4) = Cells(i - 1, 2)
            l = l + 1
        End If
    Next i
补充:VB ,  VBA
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,