Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Multiply range


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Multiply range

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Multiply range

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Multiply range

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
multiply criteria in a range using sumifs dloc Excel Worksheet Functions 1 February 5th 10 08:01 PM
Check Date Range and Multiply Stock Qty Jon[_6_] Excel Worksheet Functions 2 January 18th 08 11:52 AM
add value of 4 cells, multiply by 3 subtract 72 multiply by 80% George A. Yorks Excel Discussion (Misc queries) 10 October 25th 06 09:45 PM
multiply range of cells by a fluctuating exchange rate Oliver Excel Discussion (Misc queries) 8 September 3rd 06 09:07 AM
Would like one cell to both count and multiply a range of cells golfer18 Excel Worksheet Functions 2 February 27th 06 03:33 AM


All times are GMT +1. The time now is 11:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ╘2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"