Macro to multiplying column with cell value on another sheet

michellin

Board Regular
Joined
Oct 4, 2011
Messages
56
Office Version
  1. 2019
Platform
  1. Windows
Hy guys,

I'm working on a simple macro.

I copying number data from sheet1 column I to the sheet3 column D from d2 to (D not always the same amount) and to AG2 to (AG not always the same amount).

Sheets("sheet1").Select
Columns("I:I").Select
Selection.Copy
Sheets("sheet3").Select
Range("D:D,AG:AG").Select
ActiveSheet.Paste

that's good till there.

When those number are paste, i want to multiply them by the cell a3 on the sheet4 and paste the result in the same cell they was.

Like this
if sheet4!A3=2
d2 =5*(2) after macro d2=10
d3 =15*(2) after macro d3=30
till the end of last row

i can't find a way to do it after the paste of the column with some formula, so i need to be inserted in a macro to run it after the paste of the 2 column D and AG. Or just do it on D and i will copy the final result to AG.

Thanks guys :)

Franck
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
This code should work for you...
VBA Code:
Sub Franck()
Dim lastrow As Long
lastrow = Sheets("Sheet1").Range("I" & Rows.Count).End(xlUp).Row

With Sheets("Sheet3").Range("D1:D" & lastrow & ",AG1:AG" & lastrow)
    .Value = Sheets("Sheet1").Range("I1:I" & lastrow).Value
    Sheets("Sheet4").Range("A3").Copy
    .PasteSpecial Paste:=xlPasteAll, Operation:=xlMultiply, SkipBlanks:=False, Transpose:=False
End With
Application.CutCopyMode = False
End Sub
 
Upvote 0
Solution
OMG Z51 you the best man.

I've try so many thing, but you got it man. Taht work very well

Thanks :)

Franck
 
Upvote 0

Forum statistics

Threads
1,214,834
Messages
6,121,873
Members
449,056
Latest member
ruhulaminappu

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