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

I want to write a function in VBA which multiplies two numbers together as
follows

=Multiply(A,B,5)

A is the first value
B is the array, eg. A1:A10
5 is the 5th value of the array.

Would anybody be able to help me with this ?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Arrays problem

Try something like

Function Mult(Num1, Rng As Range, N As Long) As Double
Mult = Num1 * Rng.Cells(N)
End Function


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Ali Baba" wrote in message
...
I want to write a function in VBA which multiplies two numbers
together as
follows

=Multiply(A,B,5)

A is the first value
B is the array, eg. A1:A10
5 is the 5th value of the array.

Would anybody be able to help me with this ?

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Arrays problem

Public Function Multiply(num as double, b as Range, idx as Long)
Multiply = num * b(idx).Value
End Function

--
Regards,
Tom Ogilvy

"Ali Baba" wrote in message
...
I want to write a function in VBA which multiplies two numbers together as
follows

=Multiply(A,B,5)

A is the first value
B is the array, eg. A1:A10
5 is the 5th value of the array.

Would anybody be able to help me with this ?

Thanks



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Arrays problem

What have you tried and where are you stuck?

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
I want to write a function in VBA which multiplies two numbers together as
follows

=Multiply(A,B,5)

A is the first value
B is the array, eg. A1:A10
5 is the 5th value of the array.

Would anybody be able to help me with this ?

Thanks

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
Problem with SUMPRODUCT and Arrays [email protected] Excel Worksheet Functions 2 January 13th 06 09:55 PM
Problem using arrays in Excel Charts from VBA Chris_Hawkins Excel Programming 1 September 2nd 05 06:15 PM
VBA (arrays problem) Ali Baba Excel Programming 6 August 23rd 05 01:44 AM
Problem with plotting a chart when using arrays as Values and Xvalues [email protected] Charts and Charting in Excel 3 August 19th 05 09:05 PM
Elusive Problem with Arrays [email protected] Excel Programming 3 April 29th 05 12:50 AM


All times are GMT +1. The time now is 07:57 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"