Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi everyone! Somebody please help me: I need to multiply all cells in a specific range object by a number (it could be any number--I would like to use the value property of a spin button, for instance) and return all the number to the corresponding cells of another range object with the same characteristics (same number of cells and with cells distributed in the same way relative to each other). I have already created "Old As Range" and "New As Range",... Thank you very much in advance. Regards, Rodrigo |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One way would be to copy the value you want to multiply
the range with, select the range and paste special with operation multiply. Or you could do this for i=1 to new.rows.count -----Original Message----- Hi everyone! Somebody please help me: I need to multiply all cells in a specific range object by a number (it could be any number--I would like to use the value property of a spin button, for instance) and return all the number to the corresponding cells of another range object with the same characteristics (same number of cells and with cells distributed in the same way relative to each other). I have already created "Old As Range" and "New As Range",... Thank you very much in advance. Regards, Rodrigo . |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try the following macro. (Place it into a module.
Explanatio ======= 1) Declare two variables tmp1, tmp2, which are the "source range" and "target range" respectively 2) A variable "factor" is for setting the number to multiply with the source range '-------------------------------------------------------------- Sub multiply_range( Dim tmp1 As Range, tmp2 As Rang Dim rr As Single, cc As Intege Dim facto Set tmp1 = Range("A2:C10" Set tmp2 = Range("E2:G10" factor = For rr = 1 To tmp1.Rows.Coun For cc = 1 To tmp1.Columns.Coun If IsNumeric(tmp1.Cells(rr, cc).Value) The tmp2.Cells(rr, cc) = tmp1.Cells(rr, cc).Value * facto End I Nex Nex End Su '-------------------------------------------------------------- Regards Edwin Ta ----- Rodrigo wrote: ---- Hi everyone Somebody please help me: I need to multiply all cells in a specific range object by a number (it could be any number--I would like to use the value property of a spin button, for instance) and return all the number to the corresponding cells of another range object with the same characteristics (same number of cells and with cells distributed in the same way relative to each other). I have already created "Old As Range" and "New As Range",... Thank you very much in advance Regards Rodrigo |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Option Explicit
Sub Test() Dim r1 As Range, r2 As Range Dim cell As Range Dim factor As Single factor = 10 Set r1 = Range("A1:B4") Set r2 = Range("F4:G7") r2.Value = r1.Value For Each cell In r2.Cells cell.Value = cell.Value * factor Next cell End Sub "Rodrigo" сообщил/сообщила в новостях следующее: ... Hi everyone! Somebody please help me: I need to multiply all cells in a specific range object by a number (it could be any number--I would like to use the value property of a spin button, for instance) and return all the number to the corresponding cells of another range object with the same characteristics (same number of cells and with cells distributed in the same way relative to each other). I have already created "Old As Range" and "New As Range",... Thank you very much in advance. Regards, Rodrigo |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
multiply criteria in a range using sumifs | Excel Worksheet Functions | |||
Check Date Range and Multiply Stock Qty | Excel Worksheet Functions | |||
add value of 4 cells, multiply by 3 subtract 72 multiply by 80% | Excel Discussion (Misc queries) | |||
multiply range of cells by a fluctuating exchange rate | Excel Discussion (Misc queries) | |||
Would like one cell to both count and multiply a range of cells | Excel Worksheet Functions |