range * constant

  • Thread starter Thread starter linty
  • Start date Start date
L

linty

Can one of you Excel experts tell me how to reduce all cells in a data
array by a factor of 10 (how to multiply all cells in a range by a
constant)?
 
Hi
- put 10 in an empty cell
- copy this cell
- select your numbers
- goto 'Edit - Paste Special' and choose the action 'Multiply' (or
'Divide')
 
put 10 in a blank cell.

Select that cell and copy it.

Select the cells to be reduced and do

Edit=>Pastespecial and select Values and Divide

if you mean you have an array like

varr = Array(1000, 10000, 5000, 2000)

you can do

Sub ABCD()
Dim varr as variant, i as long
varr = Array(1000, 10000, 5000, 2000)
For i = LBound(varr) To UBound(varr)
varr(i) = varr(i) / 10
Next
For i = LBound(varr) To UBound(varr)
Debug.Print i, varr(i)
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top