例如已知第一列前10行数据为1,2,3,4,5,6,7,8,9,10;第二列前10行数据为2,4,6,8,10,12,14,16,18,20,通过条件判断第一列中大于9的数,找到后在同一个sheet中的任意两个相邻的单元格中输出该行,本例中就输出10,20,请问如何用VBA实现?!!小弟跪谢!!!
sub test()
dim i as integer,k as long,j as integer
k=activesheet.[a65536].end(3).row
for i=1 to k
if activesheet.range("a" & i).value>9 then
j=j+1
activesheet.range("a" & i & ":b" & i).copy destination:= activesheet.range("e" & j)
end if
next i
end sub
dim i as integer,k as long,j as integer
k=activesheet.[a65536].end(3).row
for i=1 to k
if activesheet.range("a" & i).value>9 then
j=j+1
activesheet.range("a" & i & ":b" & i).copy destination:= activesheet.range("e" & j)
end if
next i
end sub
温馨提示:答案为网友推荐,仅供参考