1 try
this in sheet_change
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$G$9" Or Target.Address = "$G$8" Then
my_loc = Range("G8")
my_disp = Range("G9")
With Sheets("SSR")
lcol = .UsedRange.Columns.Count
For x = 2 To lcol
If .Cells(5, x) = my_loc And .Cells(6, x) = my_disp Then
my_col = x
Exit For
End If
Next
.Range(.Cells(8, my_col), .Cells(42, my_col)).Copy
End With
With Sheets("sheet1").Range("H14")
.PasteSpecial Paste:=xlValues
End With
End If
End Sub
this in quantity add
Sub Macro1()
my_loc = Range("G8")
my_disp = Range("G9")
With Sheets("SSR")
lcol = .UsedRange.Columns.Count
For x = 2 To lcol
If .Cells(5, x) = my_loc And .Cells(6, x) = my_disp Then
my_col = x
Exit For
End If
Next
End With
For Each cl In Range("H14", "H48")
cl.Value = cl.Value + cl.Offset(, -1).Value
Next
Range("H14", "H48").Copy
With Sheets("SSR").Cells(8, my_col)
.PasteSpecial Paste:=xlValues
End With
Range("G14", "H48").ClearContents
End Sub
made also 2 named ranges for region and dispatch on extra sheet (blad1)
Kind regards
Leo
Bookmarks