Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is there some elegant way to assign values to array, for ex:
dim A(3) as integer {1,2,4} instead of dim A(3) as integer A(1)=1 A(2)=2 A(3)=4 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Juggernath,
One possibility: Dim arr As Variant arr = Array(1, 2, 4) --- Regards, Norman "Juggernath" wrote in message ... Is there some elegant way to assign values to array, for ex: dim A(3) as integer {1,2,4} instead of dim A(3) as integer A(1)=1 A(2)=2 A(3)=4 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "Norman Jones" wrote in message ... Hi Juggernath, One possibility: Dim arr As Variant arr = Array(1, 2, 4) --- Regards, Norman "Juggernath" wrote in message ... Is there some elegant way to assign values to array, for ex: dim A(3) as integer {1,2,4} instead of dim A(3) as integer A(1)=1 A(2)=2 A(3)=4 I tried it already... it says "cannot assign to array" when it comes to 2nd line. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Well it worked fine for me, as I am sure it did for Norman.
-- HTH RP (remove nothere from the email address if mailing direct) "Juggernath" wrote in message ... "Norman Jones" wrote in message ... Hi Juggernath, One possibility: Dim arr As Variant arr = Array(1, 2, 4) --- Regards, Norman "Juggernath" wrote in message ... Is there some elegant way to assign values to array, for ex: dim A(3) as integer {1,2,4} instead of dim A(3) as integer A(1)=1 A(2)=2 A(3)=4 I tried it already... it says "cannot assign to array" when it comes to 2nd line. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Juggernath,
As Bob suggests, the code worked in my test. How did you dim your array? --- Regards, Norman "Juggernath" wrote in message ... "Norman Jones" wrote in message ... Hi Juggernath, One possibility: Dim arr As Variant arr = Array(1, 2, 4) --- Regards, Norman "Juggernath" wrote in message ... Is there some elegant way to assign values to array, for ex: dim A(3) as integer {1,2,4} instead of dim A(3) as integer A(1)=1 A(2)=2 A(3)=4 I tried it already... it says "cannot assign to array" when it comes to 2nd line. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "Norman Jones" wrote in message ... Hi Juggernath, As Bob suggests, the code worked in my test. How did you dim your array? "Norman Jones" wrote in message ... Hi Juggernath, One possibility: Dim arr As Variant arr = Array(1, 2, 4) --- Regards, Norman Thanks for trying to help so far... Here is my code (Custom function in VBA - excel - OfficeXP) Dim A(11) As Double A = Array(0.3265, -1.07, -0.5339, 0.01569, -0.05165, 0.5475, -0.7361, 0.1844, 0.1056, 0.6134, 0.721) and here is my error when i run a function using subroutine on a given picture http://www.rgn.hr/~dvulin/myerror.gif (i tried dim A(10) as double, and (1 to 11)...etc.) |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Juggernath,
Try changing: Dim A(11) As Double to: Dim A As Variant --- Regards, Norman "Juggernath" wrote in message ... "Norman Jones" wrote in message ... Hi Juggernath, As Bob suggests, the code worked in my test. How did you dim your array? "Norman Jones" wrote in message ... Hi Juggernath, One possibility: Dim arr As Variant arr = Array(1, 2, 4) --- Regards, Norman Thanks for trying to help so far... Here is my code (Custom function in VBA - excel - OfficeXP) Dim A(11) As Double A = Array(0.3265, -1.07, -0.5339, 0.01569, -0.05165, 0.5475, -0.7361, 0.1844, 0.1056, 0.6134, 0.721) and here is my error when i run a function using subroutine on a given picture http://www.rgn.hr/~dvulin/myerror.gif (i tried dim A(10) as double, and (1 to 11)...etc.) |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Unfortunately not.
-- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Juggernath" wrote in message ... Is there some elegant way to assign values to array, for ex: dim A(3) as integer {1,2,4} instead of dim A(3) as integer A(1)=1 A(2)=2 A(3)=4 |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Juggernath wrote:
Is there some elegant way to assign values to array, for ex: dim A(3) as integer {1,2,4} instead of dim A(3) as integer A(1)=1 A(2)=2 A(3)=4 If the functions in the freely downloadable file at http://home.pacbell.net/beban are available to your workbook Dim A() As Integer Assign Array(1, 2, 4), A Alan Beban |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
assigning values to an array | Excel Programming | |||
Assigning a value to an array cell | Excel Programming | |||
Assigning 10x1 array to 2nd collumn of 10x3 array | Excel Programming | |||
Assigning 10x1 array to 2nd collumn of 10x3 array | Excel Programming | |||
Assigning Array Values | Excel Programming |