EXCEL VBA 编写求助

来源:百度知道 编辑:UC知道 时间:2024/05/18 08:47:08
我是用

Dim i, o As Integer
i = 1
o = Sheet21.Cells(2, 11)

If o = 1 Then
While i < 43
Sheet21.Cells(3 + i, 4) = Sheet21.Cells(3 + i, 3)
Sheet21.Cells(3 + i, 9) = Sheet21.Cells(3 + i, 8)
i = i + 1
Wend
End If

End Sub

来实现表21之间2列间的复制的.

现在要实现以下目的: 当o=1时 表Sheet21.Cells(3 + i, 4) = Sheet21.Cells(3 + i, 3) .Sheet21.Cells(3 + i, 9) = Sheet21.Cells(3 + i, 8) 空值要跳过.



If Sheet8.Cells(19, 2 + i) <> "" Then

实现 可我不知道怎么添加进去..

[em11][em11]

同时表8第13行要复制到表8第1行.

当o=2时 表21不进行操作 表8第13行复制到表8第2行

……………………

当o=12时 表21不进行操作 表8第13行复制到表8第12行

请各位大侠帮忙写段代码。

Dim i, o As Integer
i = 1
o = Sheet21.Cells(2, 11)
If o = 1 Then
While i < 43
if Sheet21.Cells(3 + i, 3)<>"" then
Sheet21.Cells(3 + i, 4) = Sheet21.Cells(3 + i, 3)
endif
if Sheet21.Cells(3 + i, 8)<>"" then
Sheet21.Cells(3 + i, 9) = Sheet21.Cells(3 + i, 8)
endif
i = i + 1
Wend
sheet8.range("A1:IV1")=sheet8.range("A13:IV13").value
End If
End Sub

至于o=2和12就不用多说了吧!