VBA Copy and Multiply

ziad alsayed

Well-known Member
Joined
Jul 17, 2010
Messages
665
dear all

please advise what is gooing wrong with the below code , it is multiplying the content of the cell by itself instead of multiplying it by one.

Code:
Range("F2") = "1"
Range("F2").Copy
 LR = Range("E" & Rows.Count).End(xlUp).Row
 Range("E2:E" & LR).Select
  Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlMultiply, _
        SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
    Range("E2").Select


appreciate any help
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
The problem is with the second 'Copy' in your code.
Excel 2010 has a better macro recorder than Excel 2007 and will give you something like the following:
Code:
    Range("F2").Select
    ActiveCell.FormulaR1C1 = "1"
    Selection.Copy
 LR = Range("E" & Rows.Count).End(xlUp).Row
 Range("E2:E" & LR).Select
    Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlMultiply, _
        SkipBlanks:=False, Transpose:=False
    Range("E2").Select
 
Upvote 0

Forum statistics

Threads
1,224,616
Messages
6,179,908
Members
452,949
Latest member
beartooth91

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