Results 1 to 4 of 4

Thread: test transpose alternative Transpose with Index

  1. #1
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,439
    Rep Power
    10

    test transpose alternative Transpose with Index

    OK . Think the might do for testing today.....

    test


    Code:
    Rem 3 outout
    Dim arrOutA() As String: Let arrOutA() = Split(strOutA, vbCr & vbLf, -1, vbBinaryCompare) '  Excel has the convention of taking a  1D  array as being "horizontal" for spreadsheet purposes, so will consider it as a row of data values if applied to a worksheet range
    Dim arrOutB() As String: Let arrOutB() = Split(strOutB, vbCr & vbLf, -1, vbBinaryCompare)
    ' Let WsOut.Range("A2").Resize(UBound(arrOutA()), 1).Value = Application.Transpose(arrOutA())
     Let WsOut.Range("A2").Resize(UBound(arrOutA()), 1).Value = Application.Index(arrOutA(), Evaluate("=row(1:" & UBound(arrOutA()) & ")/row(1:" & UBound(arrOutA()) & ")"), Evaluate("=row(1:" & UBound(arrOutA()) & ")"))
    ' Let WsOut.Range("B2").Resize(UBound(arrOutB()), 1).Value = Application.Transpose(arrOutB())
     Let WsOut.Range("B2").Resize(UBound(arrOutB()), 1).Value = Application.Index(arrOutB(), Evaluate("=row(1:" & UBound(arrOutB()) & ")/row(1:" & UBound(arrOutB()) & ")"), Evaluate("=row(1:" & UBound(arrOutB()) & ")"))
    
    '  1 D array to list in 1 column
     Let Range("T1").Resize(UBound(UnicBea()) + 1, 1).Value2 = Application.Index(UnicBea(), Evaluate("=row(1:" & UBound(UnicBea()) + 1 & ")/row(1:" & UBound(UnicBea()) + 1 & ")"), Evaluate("=row(1:" & UBound(UnicBea()) + 1 & ")"))
    
    End Sub
    Code:
    Sub EvaluateRangeIt() '  A1:A4 to C1:F1 B1:B4 to C2:F2
     Range("C1:F2").Value = Application.Index(Range("A1:B4"), Evaluate("=column(A:D)"), Evaluate("=row(1:2)"))
    End Sub
    Dik.Add Key:=Join(Application.Transpose(Range("Q1").CurrentRegion.Value2), ""), Item:="AnyThong"
    Code:
    Public Function CL(ByVal lclm As Long) As String '         http://www.excelforum.com/development-testing-forum/1101544-thread-post-appendix-no-reply-needed-please-do-not-delete-thanks-4.html#post4213980
        Do: Let CL = Chr(65 + (((lclm - 1) Mod 26))) & CL: Let lclm = (lclm - (1)) \ 26: Loop While lclm > 0
    End Function
    Alternative way to transpose 1 D array to list in 1 column
    Code:
     Let Range("F1").Resize(UBound(dDays()), 1).Value = Application.Index(dDays(), Evaluate("=row(1:" & UBound(dDays()) & ")/row(1:" & UBound(dDays()) & ")"), Evaluate("=row(1:" & UBound(dDays()) & ")"))

    Join an array of the cells
    The key to the new flexible solution is to Join the elements of an array with a comma, where the elements are the cell values, which themselves are separated already with a comma. (So then as previously, we then finally have a single string of comma separated values, which we , as previously split by a comma, to give us our single array of all data values.
    Initially we can get an array of cell values from applying the .Value property to our multi cell range.
    Something of this sort of form, for example, for if we had 4 cells in the second row,
    _________arrCels2D1Row() = Ws1.Range("A2:D2").Value2
    A small snag here is that the array returned by the .Value property, is a 1 row, 2 Dimensional array, ( a pseudo “horizontal” , “single width” array) but the VBA strings Join function only accepts a 1 dimensional array. However, it’s a strange characteristic of VBA that many things if they are asked to return something in the orientation of pseudo “horizontal” , “single width” , then they return a 1 Dimensional array: It seems that somehow the internal workings often relate a row orientation to a single dimensional array. ( This is convenient to think about, as is the idea of pseudo “horizontal” , “single width” , since in the case of a 1 dimensional array we often write it in a line like {1, 2, 3, 6, "z"} , but we should remember that strictly speaking academically orientation in arrays is subjective. )
    As example this seemingly redundant code line takes the first row from our single row 2 Dimensional array: Seemingly useless, but in fact it returns the 1 Dimensional array of cell values, as we require, -
    ___ arrCels1D() = Application.Index(arrCels2D1Row(), 1, 0)
    ___ ___ - Effectively that converts a 2 Dimensional 1 row array into a 1 Dimensional array, and why VBA has that sort of strange characteristic thing is not clearly known




    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA






    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Last edited by DocAElstein; 06-12-2023 at 05:13 PM.

  2. #2
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,439
    Rep Power
    10
    Quote Originally Posted by DocAElstein View Post
    OK . Think the might do for testing today.....
    last attempt with reply.....

    Sub TestEvaluateVBA3_n1n2n3()
    Dim RangeH3H4**As Range, RangeB3B4 As Range, RangeC3C4 As Range, RangeD3D4 As Range
    Set RangeH3H4 = Range("H3:H4")
    Set RangeB3B4 = Range("B3:B4")
    Set RangeC3C4 = Range("C3:C4")
    Set RangeD3D4 = Range("D3:D4")
    RangeH3H4 = Evaluate("**" & RangeB3B4.Address & "** " & "&""****""&" & "**** " & RangeC3C4.Address & "" & "&""****""&" & "" & RangeD3D4.Address & "")
    End Sub




    Sub TestEvaluateVBA3_n1n2n3()
    Dim RangeH3H4**As Range, RangeB3B4 As Range, RangeC3C4 As Range, RangeD3D4 As Range
    Set RangeH3H4 = Range("H3:H4")
    Set RangeB3B4 = Range("B3:B4")
    Set RangeC3C4 = Range("C3:C4")
    Set RangeD3D4 = Range("D3:D4")
    RangeH3H4 = Evaluate("**" & RangeB3B4.Address & "** " & "&""****""&" & "**** " & RangeC3C4.Address & "" & "&""****""&" & "" & RangeD3D4.Address & "")
    End Sub

  3. #3
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,439
    Rep Power
    10
    Quote Originally Posted by DocAElstein View Post
    last attempt with reply.....

    Sub TestEvaluateVBA3_n1n2n3()
    Dim RangeH3H4**As Range, RangeB3B4 As Range, RangeC3C4 As Range, RangeD3D4 As Range
    Set RangeH3H4 = Range("H3:H4")
    Set RangeB3B4 = Range("B3:B4")
    Set RangeC3C4 = Range("C3:C4")
    Set RangeD3D4 = Range("D3:D4")
    RangeH3H4 = Evaluate("**" & RangeB3B4.Address & "** " & "&""****""&" & "**** " & RangeC3C4.Address & "" & "&""****""&" & "" & RangeD3D4.Address & "")
    End Sub




    Sub TestEvaluateVBA3_n1n2n3()
    Dim RangeH3H4**As Range, RangeB3B4 As Range, RangeC3C4 As Range, RangeD3D4 As Range
    Set RangeH3H4 = Range("H3:H4")
    Set RangeB3B4 = Range("B3:B4")
    Set RangeC3C4 = Range("C3:C4")
    Set RangeD3D4 = Range("D3:D4")
    RangeH3H4 = Evaluate("**" & RangeB3B4.Address & "** " & "&""****""&" & "**** " & RangeC3C4.Address & "" & "&""****""&" & "" & RangeD3D4.Address & "")
    End Sub
    those F***ing *** again !!!

  4. #4
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,402
    Rep Power
    10
    Last edited by DocAElstein; 06-12-2023 at 05:12 PM.
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

Similar Threads

  1. Replies: 185
    Last Post: 05-22-2024, 10:02 PM
  2. VBA to Reply All To Latest Email Thread
    By pkearney10 in forum Outlook Help
    Replies: 11
    Last Post: 12-22-2020, 11:15 PM
  3. Replies: 293
    Last Post: 09-24-2020, 01:53 AM
  4. Replies: 19
    Last Post: 04-20-2019, 02:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •