求段VBA 点击按钮 将一个表格1的某些列的数据自动加载到另一个表格2里, 谢谢!
答案:1 悬赏:60 手机版
解决时间 2021-01-15 17:14
- 提问者网友:捧腹剧
- 2021-01-15 12:50
求段VBA 点击按钮 将一个表格1的某些列的数据自动加载到另一个表格2里, 谢谢!
最佳答案
- 五星知识达人网友:洒脱疯子
- 2021-01-15 12:59
sub m()
for i= 23 to range("A65536").end(3).row
if cells(i,"D")="" or cells(i,"G")="" then
exit for
else
Sheets(2).cells(i-19,"A")=cells(i,"A")
Sheets(2).cells(i-19,"B")=cells(i,"B")
Sheets(2).cells(i-19,"C")=cells(i,"C")
Sheets(2).cells(i-19,"E")=cells(i,"E")
Sheets(2).cells(i-19,"F")=cells(i,"F")
end if
next
end sub
将代码放到sheet1中,执行即可追问
忘了说控件按钮在表格2里
我稍微修改了下,调试了下,数据没反应哈,您帮忙修改下阿
for i= 23 to range("A65536").end(3).row
if cells(i,"D")="" or cells(i,"G")="" then
exit for
else
Sheets(2).cells(i-19,"A")=cells(i,"A")
Sheets(2).cells(i-19,"B")=cells(i,"B")
Sheets(2).cells(i-19,"C")=cells(i,"C")
Sheets(2).cells(i-19,"E")=cells(i,"E")
Sheets(2).cells(i-19,"F")=cells(i,"F")
end if
next
end sub
将代码放到sheet1中,执行即可追问
忘了说控件按钮在表格2里
我稍微修改了下,调试了下,数据没反应哈,您帮忙修改下阿
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯