I have this line of code
Code: Select all
a = Array(Split("Header1,Yasser,Ahmed,Reda", ","), Split("Header2,10,20,30", ","))
Code: Select all
Range("A1").Resize(UBound(a, 1) + UBound(a, 2)).Value = a
Code: Select all
a = Array(Split("Header1,Yasser,Ahmed,Reda", ","), Split("Header2,10,20,30", ","))
Code: Select all
Range("A1").Resize(UBound(a, 1) + UBound(a, 2)).Value = a
Code: Select all
a = [{"Header1","Header2";"Yasser",10;"Ahmed",20;"Reda",30}]
Range("A1").Resize(UBound(a, 1), UBound(a, 2)).Value = a
Code: Select all
Sub Arrs()
Dim a
a = Array(Split("Header1,Yasser,Ahmed,Reda", ","), Split("Header2,10,20,30", ","))
Range("A1").Resize(, UBound(a(0)) + 1).Value = a(0)
Range("A1").Offset(0, UBound(a(0)) + 1).Resize(, UBound(a(1)) + 1).Value = a(1)
End Sub
Code: Select all
Dim a
a = Array(Split("Header1,Yasser,Ahmed,Reda", ","), Split("Header2,10,20,30", ","))
Range("A1").Resize(UBound(a(0)) + 1).Value = Application.Transpose(a(0))
Range("B1").Resize(UBound(a(1)) + 1).Value = Application.Transpose(a(1))
Just like we already did to reference elements…like https://imgur.com/5E5aBvd" onclick="window.open(this.href);return false; , http://www.eileenslounge.com/viewtopic. ... 34#p266624" onclick="window.open(this.href);return false;YasserKhalil wrote:How would be looped in such array..? and how we call such nested arrays?
Code: Select all
Sub HarraysInAourray() ' http://www.eileenslounge.com/viewtopic.php?f=30&t=34371&p=266633#p266634
Dim Aout As Long, Hin As Long, a
a = Array(Split("Header1,Yasser,Ahmed,Reda", ","), Split("Header2,10,20,30", ","))
Dim TooDee() As String: ReDim TooDee(1 To UBound(a(0)) + 1, 1 To UBound(a) + 1)
For Aout = LBound(a) To UBound(a) 'we have a 2 element, 1 D array, 0 To 1, and...._
For Hin = LBound(a(Aout)) To UBound(a(Aout)) '_... inside of each 2 elements is a 4 element ,1 D array, 0 To 3 - a(0)( 0 To 3 ) , a(1)( 0 To 3 )
'MsgBox prompt:=a(Aout)(Hin)
Let TooDee(Hin + 1, Aout + 1) = a(Aout)(Hin)
Next Hin
Next Aout
Range("A1").Resize(UBound(TooDee(), 1), UBound(TooDee(), 2)).Value = TooDee()
End Sub
I can’t really say very accurately: That varies a lot depending on how many columns and also your computer, Excel version etc..YasserKhalil wrote:But what if the array has over 1 million rows?
Code: Select all
Sub HArraysInAourray2() ' http://www.eileenslounge.com/viewtopic.php?f=30&t=34371#p266691
ActiveSheet.Cells.ClearContents
Dim a() As Variant, b() As Variant, Clms() As Variant
Let a() = Array(Split("Header1,Yasser,Ahmed,Reda", ","), Split("Header2,10,20,30", ","))
Let b() = Application.Index(a(), Evaluate("=Row(1:2)"), Array(1, 2, 3, 4))
Let b() = Application.Index(a(), Evaluate("=Row(1:2)"), Evaluate("=Column(A:D)"))
' Index HarasyInAourasy.JPG : https://imgur.com/fzb2GEo , https://imgur.com/p7QKdwU
Dim strEval As String
Let strEval = "=Column(A:D)": Debug.Print strEval
Let strEval = "=Column(A:" & Split(Cells(1, 4).Address, "$")(1) & ")": Debug.Print strEval
Let Clms() = Evaluate(strEval): Let Clms() = Evaluate("=Column(A:" & Split(Cells(1, 4).Address, "$")(1) & ")")
Let b() = Application.Index(a(), Evaluate("=Row(1:2)"), Clms())
Let b() = Application.Index(a(), Evaluate("=Row(1:2)"), Evaluate("=Column(A:" & Split(Cells(1, 4).Address, "$")(1) & ")"))
Let b() = Application.Index(a(), Evaluate("=Row(1:2)"), Evaluate("=Column(A:" & Split(Cells(1, UBound(a(0)) + 1).Address, "$")(1) & ")"))
Let b() = Application.Index(a(), Evaluate("=Row(1:" & UBound(a()) + 1 & ")"), Evaluate("=Column(A:" & Split(Cells(1, UBound(a(0)) + 1).Address, "$")(1) & ")"))
Range("A1").Resize(UBound(a()) + 1, UBound(a(0)) + 1).Value = b()
ActiveSheet.Cells.ClearContents
Range("A1").Resize(UBound(a(0)) + 1, UBound(a()) + 1).Value = Application.Transpose(b())
ActiveSheet.Cells.ClearContents
Range("A1").Resize(UBound(a(0)) + 1, UBound(a()) + 1).Value = Application.Transpose(Application.Index(a(), Evaluate("=Row(1:2)"), Evaluate("=Column(A:" & Split(Cells(1, UBound(a(0)) + 1).Address, "$")(1) & ")")))
End Sub
Code: Select all
Sub HArraysInAourray3()
Dim a
a = Array(Split("Header1,Yasser,Ahmed,Reda", ","), Split("Header2,10,20,30", ","))
Range("A1").Resize(UBound(a(0)) + 1, UBound(a) + 1).Value = Application.Transpose(Application.Index(a, Evaluate("=Row(1:" & UBound(a) + 1 & ")"), Evaluate("=Column(A:" & Split(Cells(1, UBound(a(0)) + 1).Address, "$")(1) & ")")))
End Sub
Code: Select all
Evaluate("=Row(1:2)")
Code: Select all
Evaluate("=Row(1:" & UBound(a) + 1 & ")")