|
↓このように、Selectしない書き方を学習して下さい。
Sub test()
Dim i As Long
Dim j As Long
Dim ws As Worksheet
Set ws = Worksheets("集計")
i = 27
j = 2
ws.Range("b5:h14").ClearContents
With ws
Do While .Cells(25, i) <> ""
'空欄になるまで実行
If .Cells(25, i).Value = .Cells(20, 27).Value And _
.Cells(26, i).Value = .Cells(21, 27).Value Then
.Range(.Cells(29, i), .Cells(38, i)).Copy
.Cells(5, j).PasteSpecial Paste:=xlValues
Application.CutCopyMode = False
j = j + 1
End If
i = i + 1
Loop
End With
Set ws = Nothing
グラフ1.Select
End Sub
|
|