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

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
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,224,548
Messages
6,179,448
Members
452,915
Latest member
hannnahheileen

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