|    | 
     Offset関数で、列方向に 月数−4 移動するようにしてみました。 
 
Sub sample() 
Dim 資材 As Single, 工作 As Single, 設計 As Single 
Dim 生産設計 As Single, その他 As Single 
Dim ws1 As Worksheet, ws2 As Worksheet 
Dim mycol As Long 
 
  'シートをオブジェクト変数に格納 
  Set ws1 = Worksheets("品質会議 実績グラフ") 
  Set ws2 = Worksheets("工作品質会議資料") 
   
  '計算式(小数点第二位切り上げ) 
  With Application.WorksheetFunction 
    資材 = .RoundUp((ws1.Range("B50") * 1000) / 1000000, 1) 
    工作 = .RoundUp((ws1.Range("B51") * 1000) / 1000000, 1) 
    設計 = .RoundUp((ws1.Range("B52") * 1000) / 1000000, 1) 
    生産設計 = .RoundUp((ws1.Range("B53") * 1000) / 1000000, 1) 
    その他 = .RoundUp((ws1.Range("B54") * 1000) / 1000000, 1) 
  End With 
  
   
  mycol = CLng(Left(Worksheets(5).Range("I1").Value, _ 
      Len(Worksheets(5).Range("I1").Value - 1))) 
   
    With ws1 
      .Cells(7, 3).Offset(0, mycol - 4).Value = 資材 
      .Cells(8, 3).Offset(0, mycol - 4).Value = 工作 
      .Cells(9, 3).Offset(0, mycol - 4).Value = 設計 
      .Cells(10, 3).Offset(0, mycol - 4).Value = 生産設計 
      .Cells(11, 3).Offset(0, mycol - 4).Value = その他 
      .Cells(13, 3).Offset(0, mycol - 4).Value = .Range("C12").Value 
    End With 
   
    With ws2 
      .Cells(5, 3).Offset(0, mycol - 4).Value = 資材 
      .Cells(6, 3).Offset(0, mycol - 4).Value = 工作 
      .Cells(7, 3).Offset(0, mycol - 4).Value = 設計 
      .Cells(8, 3).Offset(0, mycol - 4).Value = 生産設計 
      .Cells(9, 3).Offset(0, mycol - 4).Value = その他 
      .Cells(11, 3).Offset(0, mycol - 4).Value = .Range("C10").Value 
    End With 
 
End Sub 
 | 
     
    
   |