|
发表于 2016-8-15 21:51
|
显示全部楼层
本楼为最佳答案
cocotin 发表于 2016-8-15 21:38
请问老师,怎么修改呢? - Sub 圆角矩形1_Click()
- Dim myrow, myrow1, x, mycount
- myrow = Application.CountA(Range("c5:c9")) + 4
- myrow1 = Sheets("收支详情表").Range("c65536").End(xlUp).Row
- mycount = Application.CountIf(Sheets("收支详情表").Range("D:D"), [R2])
- If mycount > 0 Then
- MsgBox "已有该号码,请不要重复输入"
- Exit Sub
- End If
- For x = 5 To myrow
- With Sheets("收支详情表")
- If myrow1 = 3 Then
- myrow1 = myrow1 + 2
- Else
- myrow1 = myrow1 + 1
- End If
- .Range("c" & myrow1) = Cells(x, 2)
- .Range("f" & myrow1) = Cells(3, 4)
- .Range("g" & myrow1) = Cells(3, 7)
- .Range("h" & myrow1) = Cells(x, 3)
- .Range("j" & myrow1) = Cells(x, 10)
- .Range("k" & myrow1) = Cells(x, 11)
- .Range("l" & myrow1) = Cells(x, 13)
- .Range("m" & myrow1) = Cells(x, 15)
- .Range("x" & myrow1) = Cells(3, 12)
- .Range("y" & myrow1) = Cells(3, 14)
- .Range("ab" & myrow1) = Cells(2, 3)
- .Range("ac" & myrow1) = Cells(1, 3)
- .Range("ad" & myrow1) = Cells(11, 12)
- .Range("aj" & myrow1) = Cells(x, 18)
- .Range("e" & myrow1) = Cells(3, 18)
- .Range("d" & myrow1) = Cells(2, "r")
- End With
- Next x
- MsgBox "输入成功"
- End Sub
复制代码 |
|