vba 工作案例-sheet间拷贝内容

核心代码就是Copy Destination

Sub copy_data()
'
' copy_data 宏
' '
Dim fzjgs() As Variant
Dim cities As Variant cities = Array("广州", "深圳", "珠海", "汕头", "佛山", "韶关", "湛江", "肇庆", "江门", "茂名", "惠州", "梅州", "汕尾", "河源", "阳江", "清远", "东莞", "中山", "潮州", "揭阳", "云浮", "顺德", "南海")
fzjgs = Array("粤A", "粤B", "粤C", "粤D", "粤E", "粤F", "粤G", "粤H", "粤J", "粤K", "粤L", "粤M", "粤N", "粤P", "粤Q", "粤R", "粤S", "粤T", "粤U", "粤V", "粤W", "粤X", "粤Y") For i = 0 To UBound(fzjgs, 1) Step 1
Name = cities(i) + "-" + fzjgs(i)
'MsgBox (Name)
Sheets("数据").Range("c2:h35").Offset(i * 34, 0).Copy Destination:=Sheets(Name).Range("e3:j36")
Sheets("数据").Range("c2:h35").Offset(i * 34, 0).Copy Destination:=Sheets(Name).Range("k3:p36")
Sheets("数据").Range("c2:h35").Offset(i * 34, 0).Copy Destination:=Sheets(Name).Range("q3:v36")
Sheets("数据").Range("c2:h35").Offset(i * 34, 0).Copy Destination:=Sheets(Name).Range("w3:ab36")
Next i
MsgBox ("数据分割完成")
End Sub
上一篇:连接mysql 出现:java.sql.SQLException: Unable to load authentication plugin 'caching_sha2_password'.


下一篇:从零开始学JAVA(08)-使用SpringMVC4 Restful 风格引用静态文件 css/js/png