Multiplying Macro Help

pennstate710

New Member
Joined
Jul 25, 2017
Messages
3
Hi - I am trying to run a macro that would multiply 3 cells in my sheet by 2 and subsequently replace those original numbers by the multiplies numbers. Looking to have this accomplished by tying it to a shape click

FOr example:
K2 = 2
L2 = 0
M2 = 6

Looking to click a shape tied to a macro and multiply each of those by 2 and then enter that number in K2, L2, M2

Any thoughts?

Thanks
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

JimM

Well-known Member
Joined
Nov 11, 2003
Messages
736
I'm sure there is a more elegant way but

Sub doubleup()

For Each c In Range("k2:m2")

c.Value = c.Value * 2

Next c

End Sub
 

t0ny84

Board Regular
Joined
Jul 6, 2020
Messages
141
Office Version
  1. 365
  2. 2016
  3. 2013
Platform
  1. Windows
  2. Mobile
  3. Web
VBA Code:
Sub countr()
Dim cell1 As Integer
Dim cell2 As Integer
Dim cell3 As Integer

cell1 = ActiveSheet.Range("A1").Value
cell2 = ActiveSheet.Range("A2").Value
cell3 = ActiveSheet.Range("A3").Value

ActiveSheet.Range("A1") = cell1 * 2
ActiveSheet.Range("A2") = cell2 * 2
ActiveSheet.Range("A3") = cell3 * 2
End Sub

Just need to change the A1, A2, A3 to be your cell references.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
68,339
Office Version
  1. 365
Platform
  1. Windows
Another option
VBA Code:
Sub pennstate()
   With Range("K2:M2")
      .Value = Evaluate("If({1}," & .Address & " * 2)")
   End With
End Sub
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,579
Messages
5,770,958
Members
425,653
Latest member
UNSING

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
Top