dankello
02-18-2017, 11:35 AM
Hi,
With the VBA code below I need to increment certain values for each row (10 rows altogether). For example when the loop is on row #2 then values in the below code would change to:
For Each col In rng
If col.Value = Range("Milestones!D7").Value Then
Worksheets("Timeline").Range("6:6").ClearContents
Worksheets("Timeline").Range(col.Address).Offset(2, 0).Value = Range("Milestones!C7").Value
End If
Next col
This is my original code (row 1).
Private Sub Worksheet_Change(ByVal Target As Range)
' For rows 1-10 do this...
Dim rng As Range
Set rng = Application.Range("Timeline!B4:ABC4")
Dim col As Range
For Each col In rng
If col.Value = Range("Milestones!D6").Value Then
Worksheets("Timeline").Range("5:5").ClearContents
Worksheets("Timeline").Range(col.Address).Offset(1, 0).Value = Range("Milestones!C6").Value
End If
Next col
End Sub
Can anyone help with code to loop and increment each value?
Thanks,
Dan
With the VBA code below I need to increment certain values for each row (10 rows altogether). For example when the loop is on row #2 then values in the below code would change to:
For Each col In rng
If col.Value = Range("Milestones!D7").Value Then
Worksheets("Timeline").Range("6:6").ClearContents
Worksheets("Timeline").Range(col.Address).Offset(2, 0).Value = Range("Milestones!C7").Value
End If
Next col
This is my original code (row 1).
Private Sub Worksheet_Change(ByVal Target As Range)
' For rows 1-10 do this...
Dim rng As Range
Set rng = Application.Range("Timeline!B4:ABC4")
Dim col As Range
For Each col In rng
If col.Value = Range("Milestones!D6").Value Then
Worksheets("Timeline").Range("5:5").ClearContents
Worksheets("Timeline").Range(col.Address).Offset(1, 0).Value = Range("Milestones!C6").Value
End If
Next col
End Sub
Can anyone help with code to loop and increment each value?
Thanks,
Dan