View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Craig Craig is offline
external usenet poster
 
Posts: 33
Default Macro to take selected cells times a selected cell

Thanks for the help!


"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
Craig

Sub test()
Dim ocell As Range
For Each ocell In Selection
ocell.Value = ocell.Value * Range("B2").Value
Next ocell
End Sub

Manually you can select B2 and copy.

Then select all the cells to change and paste specialmultiplyOKEsc


Gord Dibben Excel MVP

On Sun, 23 Oct 2005 17:56:12 -0500, "Craig" wrote:

I have a row of hardcoded numbers in cells A1, A2, A3 A4. I want to be
able
to highlight(select) the above cells and have them be multiplied by B2.
Is
this possible.

I have a huge worksheet that has all hardcoded numbers that I need to be
multiplied by a certain cell. In the above instance B2.

So instead of going into each cell, placing an "=" in front of the value
and
then putting an * B2 at the end of the value in each cell, I am trying to
figure out how set up a macro and do it automatically.