vba 工作案例1
手上有一份关于广东22个地市的数据,行列不符合预期的表结构,稍vba转换下,再text import 到oracle.
Sub copy()
'
' copy 宏
'
' 快捷键: Ctrl+Shift+I
'
Dim cityArray As Variant
cityArray = 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 = 1 To 22 Step 1
Range("C3:H36").Offset(0, 6 * i).Select
Selection.Copy
LastRow = Range("C1").End(xlDown).Row + 1
Range("C" & LastRow).Select
ActiveSheet.Paste
Range("A3:A36").Select
Selection.Copy
LastRow2 = Range("A1").End(xlDown).Row + 1
Range("A" & LastRow2).Select
ActiveSheet.Paste
Range("B3:B36").Offset(34*i,0).value = cityArray(i)
Next i
End Sub