'Excelの指定行列をコピーする!!
Private Sub Hairetsu(targetWorkbook As Workbook, newWorkbook As Workbook)
Dim cols As Variant
Dim rows As Variant
Dim x As Long
Dim y As Long
Dim targetWoorkSheet As Worksheet
Dim newWorkSheet As Worksheet
cols = Array("C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q")
rows = Array("7", "9", "10", "11", "13", "14", "15", "16", "17")
Set targetWoorkSheet = targetWorkbook.Worksheets(SHEET_NAME_1)
Set newWorkSheet = newWorkbook.Worksheets(SHEET_NAME_2)
For x = 0 To UBound(cols)
For y = 0 To UBound(rows)
newWorkSheet.Range(cols(x) & rows(y)).Value = targetWoorkSheet.Range(cols(x) & rows(y)).Value
Next y
Next x
Set targetWoorkSheet = Nothing
Set newWorkSheet = Nothing
End Sub
VBで配列処理
トラックバック(0)
トラックバックURL: http://www.atomsware.co.jp/mt/mt-tb.cgi/158
コメントする