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

Hi all can any one help me with the following

Sub....

A1=Array(10)
A2=Array(10)
..................
Dim X3 Date
Dim X4 Date
Dim X5 Long

A1(9) = Range("B8:L8")
A2(9) = Range ("B9:L9")

X5=(X3-X4)*1440
............
I need to be able to take the difference of arrays (A1-A2) divide with X5
and put into a range of cells.. I do not know how to multiply Arrays

for example Range("N9:W9")=(A1-A2)/X5 does not work.....

does anyone have a sample of how to multiply an array with a constant?

Thank you

John


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 176
Default Array multiplication addition

John,

I think the easiest thing will be to use formulas in the target range:

Dim X3 Date
Dim X4 Date
Dim X5 Long

X3 = whatever....
X4 = whatever....
X5=(X3-X4)*1440

Range("N9:W9").Formula = "=(B8-B9)/" & X5

HTH,
Bernie
MS Excel MVP

"John" wrote in message
u...
Hi all can any one help me with the following

Sub....

A1=Array(10)
A2=Array(10)
.................
Dim X3 Date
Dim X4 Date
Dim X5 Long

A1(9) = Range("B8:L8")
A2(9) = Range ("B9:L9")

X5=(X3-X4)*1440
...........
I need to be able to take the difference of arrays (A1-A2) divide

with X5
and put into a range of cells.. I do not know how to multiply Arrays

for example Range("N9:W9")=(A1-A2)/X5 does not work.....

does anyone have a sample of how to multiply an array with a

constant?

Thank you

John




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Array multiplication addition

There no magic way to multiply an array. Just do it an element at a time:

Sub a()
Dim Arr(1 To 2)
Dim Counter As Integer
Arr(1) = 1
Arr(2) = 2
For Counter = LBound(Arr) To UBound(Arr)
Arr(Counter) = Arr(Counter) * 2
Next
MsgBox Arr(1) & " " & Arr(2)
End Sub


--
Jim Rech
Excel MVP


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default Array multiplication addition

If the functions in the freely downloadable file at
http://home.pacbell.net/beban are available to your workbook:

=ScalarMult(myArray, k) to multiply each element of the array by the
scalar k. To divide, enter False as the 3rd argument.

Alan Beban

John wrote:
Hi all can any one help me with the following

Sub....

A1=Array(10)
A2=Array(10)
.................
Dim X3 Date
Dim X4 Date
Dim X5 Long

A1(9) = Range("B8:L8")
A2(9) = Range ("B9:L9")

X5=(X3-X4)*1440
...........
I need to be able to take the difference of arrays (A1-A2) divide with X5
and put into a range of cells.. I do not know how to multiply Arrays

for example Range("N9:W9")=(A1-A2)/X5 does not work.....

does anyone have a sample of how to multiply an array with a constant?

Thank you

John



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
multiplication of two array in a particular way Rahul Excel Worksheet Functions 2 June 26th 08 01:21 PM
Addition & multiplication formula Vi Excel Discussion (Misc queries) 7 January 18th 08 05:32 PM
Multiplication Danny Mac Excel Worksheet Functions 8 December 7th 06 10:28 PM
multiplication fitpeach3 Excel Worksheet Functions 2 September 19th 06 11:07 PM
Charts multiplication Valdi Charts and Charting in Excel 1 August 11th 05 09:34 PM


All times are GMT +1. The time now is 03:19 AM.

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

About Us

"It's about Microsoft Excel"