核心代码就是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