I have used the formula below to get a specific set of cells to produce a multiplied figure, however it will only work for one row. Each time I change the details in the formula to include another row it deletes the info that was added for the previous row. Is there a way to use the formula on multiple rows that have different values? For example, I need C3:I3 to multiply by 10 but I need C5:I5 to multiply by 18.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H1:H10" '<== change to suit
Const SET_VALUE As Long = 23 '<== change to suit
On Error GoTo ws_exit
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If IsNumeric(.Value) Then .Value = .Value * SET_VALUE
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H1:H10" '<== change to suit
Const SET_VALUE As Long = 23 '<== change to suit
On Error GoTo ws_exit
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If IsNumeric(.Value) Then .Value = .Value * SET_VALUE
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub