PC Review


Reply
Thread Tools Rate Thread

Array +fonction+vba

 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      2nd Aug 2007
Sub combinearrays()
Dim tab1, tab2, tab3
Dim lb1 As Long, lb2 As Long
Dim ub1 As Long, ub2 As Long
Dim n As Long, n1 As Long
Dim i As Long, s As String
tab1 = Array(1, 2, 3, 4)
tab2 = Array(1, 2, 5, 6, 7, 8, 9, 10, 11, 12)
lb1 = LBound(tab1)
ub1 = UBound(tab1)
lb2 = LBound(tab2)
ub2 = UBound(tab2)
n = ub1 - lb1 + 1 + ub2 - lb2 + 1

ReDim tab3(1 To n)
n1 = 0
For i = lb1 To ub1
n1 = n1 + 1
tab3(n1) = tab1(i)
s = s & tab3(n1) & ","
Next
For i = lb2 To ub2
n1 = n1 + 1
tab3(n1) = tab2(i)
s = s & tab3(n1) & ","
Next
Debug.Print UBound(tab3) - LBound(tab3) + 1
Debug.Print Left(s, Len(s) - 1)
End Sub


--
Regards,
Tom Ogilvy




"PST" wrote:

> Hello
>
> Array +fonction+vba
>
> That is to say 2 arrays Tab1(4) and Tab2(10)
>
> I would like Tab1+Tab2 = tab3(14) and knowledge if it is posible
> to apply a function to an array
>
> Ex: Aplication.Worshetfunction.Average(Tab3)
> Average is just an example not the right function
>
>
> Different need to know the number of element in Tab3 without loops
>
> ex:
>
> Array1 (1,2,3,4)
>
> Array2 (1,2,5,6,7,8,9,10,11,12)
>
> Array1+Array2=Array3
>
>
> Array3(1,2,1,2,3,4,5,6,7,8,9,10,11,12)
>
> 12 different number
>
> Thank you
>

 
Reply With Quote
 
 
 
 
PST
Guest
Posts: n/a
 
      2nd Aug 2007
Hello

Array +fonction+vba

That is to say 2 arrays Tab1(4) and Tab2(10)

I would like Tab1+Tab2 = tab3(14) and knowledge if it is posible
to apply a function to an array

Ex: Aplication.Worshetfunction.Average(Tab3)
Average is just an example not the right function


Different need to know the number of element in Tab3 without loops

ex:

Array1 (1,2,3,4)

Array2 (1,2,5,6,7,8,9,10,11,12)

Array1+Array2=Array3


Array3(1,2,1,2,3,4,5,6,7,8,9,10,11,12)

12 different number

Thank you
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
fonction SI à résoudre formaction Microsoft Excel Discussion 1 7th Jun 2007 11:31 AM
why it s not fonction the microsoftoffice =?Utf-8?B?dGhvcg==?= Microsoft Word New Users 2 13th Jan 2007 08:28 AM
Le dialogue de fonction d'excel appel ma fonction "user defined" nicolas.gendron@gmail.com Microsoft Excel Programming 0 1st Mar 2006 02:28 AM
Help with max() fonction anyways Microsoft Excel Worksheet Functions 3 22nd Feb 2006 04:46 PM
Fonction IsEmpty imej-clavier Microsoft Excel Misc 1 6th Sep 2004 07:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:33 PM.