One Range Multiply By Another Range With Worksheet change event

nidhipatel

Board Regular
Joined
Feb 11, 2017
Messages
52
in sheet1
Range A1:A5 multiply with B1:B5 and result show in range C1:C5

if enter any value in cell A1 and B1 than result show in C1 only.
if enter any value in cell A2 and B2 than result show in C2 only.
if enter any value in cell A3 and B3 than result show in C3 only.
if enter any value in cell A4 and B4 than result show in C4 only.
if enter any value in cell A5 and B5 than result show in C5 only.

with worksheet change event by vba
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Try:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    
    If Target.Count = 1 And Not Intersect(Target, Cells(1, 1).Resize(5)) Is Nothing Then Cells(Target.Row, 3) = Cells(Target.Row, 1) * Cells(Target.Row, 2)
    
End Sub
 
Upvote 0
Added part in red, works for me where if I enter any value in A1:B5, the product is shown in column C of that row
Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
    
    If Target.Count = 1 And Not Intersect(Target, Cells(1, 1).Resize(5, 2)) Is Nothing Then Cells(Target.Row, 3) = Cells(Target.Row, 1) * Cells(Target.Row, 2)
    
End Sub
Tested on a new sheet, code added to worksheet event
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,717
Members
448,985
Latest member
chocbudda

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top