(Solved) – Modify VBA code to change cell input separately for each row

  • by

I’ve been troubleshooting this for a while, and am stuck… I’d like this to run on a row-by-row basis, where columns F thru L are multiplied by the value in column D when a number is entered. Any suggestions? (I am not a good programmer, but really want this functionality in my spreadsheet!) Thank you!

Private Sub Worksheet_Change(ByVal Target As Range)

    Dim rng As Range
    Dim row As Range
    Dim cell As Range
    Dim rate As Double

    Set rng = Application.Intersect(Target, Me.Range("D74:L200"))

    If Not rng Is Nothing Then
        Application.EnableEvents = False
        for Each row In rng.Rows
            rate = row.Columns.Item(0).Value
            For Each cell In row.Cells
                cell.Value = cell.Value * rate
            Next cell
        Next row
        Application.EnableEvents = True
    End If

End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *