+ Reply to Thread
Results 1 to 10 of 10

Multidimensional Array to Single Column Range

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585

    Multidimensional Array to Single Column Range

    Hello all,

    I am trying to put a multiple column range into an array and write it back to a single range.
    This is what I have so far but can't get it working properly.

    I see what the problem is but am not experienced enough with arrays to solve it
    It overwrites 7 times the cell value before going to the next row.

    Dim Arr() As Variant
    Arr = Range("F21:L72")
    
    For i = 1 To UBound(Arr)
        For j = 1 To 7
            Cells(i, 50).Value = Arr(i, j)
        Next j
    Next i
    All help is welcome.

  2. #2
    Forum Contributor kalbasiatka's Avatar
    Join Date
    02-27-2016
    Location
    Brest, Belarus
    MS-Off Ver
    2021
    Posts
    224

    Re: Multidimensional Array to Single Column Range

    Hi. No one but you knows what should be the result. Show in the file what needs to be done with an array.
    To do it for me and help me it is 2 different things!
    Sorry for my english, blame Google translator

  3. #3
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    1,028

    Re: Multidimensional Array to Single Column Range

    By 'single range' you mean single column, right?
    Maybe this:
    Dim Arr() As Variant
    Arr = Range("F21:L72")
    
    For i = 1 To UBound(Arr)
        For j = 1 To 7
            k = k + 1
            Cells(k, 50).Value = Arr(i, j)
        Next j
    Next i

  4. #4
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585
    Quote Originally Posted by Akuini View Post
    By 'single range' you mean single column, right?
    Maybe this:
    Dim Arr() As Variant
    Arr = Range("F21:L72")
    
    For i = 1 To UBound(Arr)
        For j = 1 To 7
            k = k + 1
            Cells(k, 50).Value = Arr(i, j)
        Next j
    Next i
    Thanks Akuini this is working great!

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Multidimensional Array to Single Column Range

    For each loop in 2d array goes downwards first...
    Sub test()
        Dim Arr, e, n As Long
        Arr=Range ("F21:L72")
        For Each e In Arr
            n = n + 1: Cells(n, 50) = e
        Next
    End Sub
    Last edited by jindon; 05-09-2016 at 04:35 AM. Reason: Fixed a Typo

  6. #6
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585
    Quote Originally Posted by jindon View Post
    For each loop in 2d array goes downwards first...
    Sub test()
        Dim Arr, e, n As Long
        Arr=Range ("F21:L72")
        For Each e In Arr
            n = n + 1: Cells(n, 50) = e
        Next
    End Sub
    Thanks jindon, I go for akuinis solution because I found yours harder to understand

  7. #7
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Multidimensional Array to Single Column Range

    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  8. #8
    Forum Contributor
    Join Date
    08-19-2009
    Location
    Netherlands, Amsterdam
    MS-Off Ver
    Excel 2010
    Posts
    585
    Quote Originally Posted by pike View Post

    Thanks Pike but I needed a VBA solution

  9. #9
    Forum Expert Doc.AElstein's Avatar
    Join Date
    05-23-2014
    Location
    '_- Germany >Outside Building things.... Mostly
    MS-Off Ver
    Office 2003 2007 2010 PC but Not mac. XP and Vista mostly, sometimes Win 7
    Posts
    3,618

    Re: Multidimensional Array to Single Column Range

    So here is another solution to add to the collection

    But First.......

    _1)

    As kalbasiatka said No one but you knows what should be the result. It is always best to demonstrate to us ( preferably with reduced size, desensitised data ) exactly what You want

    Both Akuini’s and jindon codes work for me.
    Jindon’s goes ( strangely ? ) through all rows first, then columns. ( I thought VBA and Excel always went from right to left then top to bottom? Maybe a Arr is different)

    Akuini’s is made to go through each column before going down a row.

    I do not feel like doing Pike’s solution way just now, ( although at first glance it does seem to be explained very well ), but I would like to see it applied to your application as another interesting solution, How about it Pike ?

    My Guess was that you wanted rows then columns, as you have confirmed now. My Code does that.
    Note All codes just give you Values Out

    To demo first on reduced data for our three codes.

    Say this is your Data


    Using Excel 2007
    Row\Col
    F
    G
    H
    21
    f21
    g21
    h21
    22
    f22
    g22
    h22
    23
    f23
    g23
    h23
    pgcArraysSplitToColumn
    _.....

    then using a version of code from Akuini

    Sub Akuini()
    Columns(50).ClearContents
    Dim Arr() As Variant
    Arr = Range("F21: H24")
    Dim i As Long, j As Long, k As Long
    For i = 1 To UBound(Arr)
        For j = 1 To 7
            k = k + 1
            Cells(k, 50).Value = Arr(i, j)
        Next j
    Next i
    End Sub
    You get this:

    Using Excel 2007
    Row\Col
    AX
    1
    f21
    2
    g21
    3
    h21
    4
    f22
    5
    g22
    6
    h22
    7
    f23
    8
    g23
    9
    h23
    pgcArraysSplitToColumn
    _...............................................
    Or
    using a version of code from jindon

    Sub jindon()
    Columns(50).ClearContents
        Dim Arr, e, n As Long
        Arr = Range("F21:H23")
        For Each e In Arr
            n = n + 1: Cells(n, 50) = e
        Next
    End Sub
    You get

    Using Excel 2007
    Row\Col
    AX
    1
    f21
    2
    f22
    3
    f23
    4
    g21
    5
    g22
    6
    g23
    7
    h21
    8
    h22
    9
    h23
    pgcArraysSplitToColumn

    _...........................................
    _... OK back to mother code alternative.

    _....
    _2 ) Here is my equivalent code ( to Akuini’s) . It gives the same results as Akuini’s
    Here for the reduced input Range
    Main Code for reduced Data
    Sub AlanSHimpfGlified()
    Dim rngIn As Range: Set rngIn = Range("F21:H23")
    Range("AX1").Resize((rngIn.Rows.Count * rngIn.Columns.Count), 1).Value = Application.Transpose(Application.Index(Cells, Evaluate("if(column(A:" & shgMathsVBA(rngIn.Rows.Count * rngIn.Columns.Count) & "),(int((column(A:" & shgMathsVBASHimpfGlified(rngIn.Rows.Count * rngIn.Columns.Count) & ")+(" & rngIn.Columns.Count & "-1))/" & rngIn.Columns.Count & "))+(" & rngIn.Row & "-1))"), Evaluate("if(column(A:" & shgMathsVBASHimpfGlified(rngIn.Rows.Count * rngIn.Columns.Count) & "),mod(column(A:" & shgMathsVBASHimpfGlified(rngIn.Rows.Count * rngIn.Columns.Count) & ")-1," & rngIn.Columns.Count & ")+" & rngIn.Column & ")")))
    End Sub

    Here the code for what we guessed was your wanted Output Range
    Main Code for Full input Range
    Sub AlanSHimpfGlified()
    Dim rngIn As Range: Set rngIn = Range("F21:L72")
    Range("AX1").Resize((rngIn.Rows.Count * rngIn.Columns.Count), 1).Value = Application.Transpose(Application.Index(Cells, Evaluate("if(column(A:" & shgMathsVBA(rngIn.Rows.Count * rngIn.Columns.Count) & "),(int((column(A:" & shgMathsVBASHimpfGlified(rngIn.Rows.Count * rngIn.Columns.Count) & ")+(" & rngIn.Columns.Count & "-1))/" & rngIn.Columns.Count & "))+(" & rngIn.Row & "-1))"), Evaluate("if(column(A:" & shgMathsVBASHimpfGlified(rngIn.Rows.Count * rngIn.Columns.Count) & "),mod(column(A:" & shgMathsVBASHimpfGlified(rngIn.Rows.Count * rngIn.Columns.Count) & ")-1," & rngIn.Columns.Count & ")+" & rngIn.Column & ")")))
    End Sub
    As you can see the difference is very little, but the reduced example is better to follow and understand in the Thread.
    My Codes are very flexible: You just change the
    Input range
    and
    Top Cell Range
    of where the output should go.

    Note: For both my codes you need also this Function. Just copy it to the same Module that your main code is in. There are simple Functions to do that BTW. Just that seemed the quickest. Many of those are explained in detail here:
    http://www.excelforum.com/tips-and-t...explained.html


    A Function to get Column Letter from Column Number

    Public Function shgMathsVBASHimpfGlified(ByVal lclm As Long) As String '   http://www.excelforum.com/tips-and-tutorials/1108643-vba-column-letter-from-column-number-explained.html#post4221359
    Let shgMathsVBASHimpfGlified = IIf(((((lclm - 1) \ 26) - 1) \ 26), Chr(65 + (((((lclm - 1) \ 26) - 1) \ 26) - 1 Mod 26)), "") & IIf(((lclm - 1) \ 26), Chr(65 + (((lclm - 1) \ 26) - 1) Mod 26), "") & IIf(lclm, Chr(65 + (lclm - 1) Mod 26), "")
    End Function
    _..................................................

    There you go.
    .. or almost....
    Quote Originally Posted by Jonathan78 View Post
    .....I go for akuinis solution ......because I found yours harder to understand
    I do not like to use codes I do not understand. Mine is very hard to understand , but if you can you would learn a lot. For the benefit of anyone interested, in the next post I explain it in full detail, ( For ease of explanation it works on the reduced size data I gave in the first screen shot above.
    '_- Google first, like this _ site:ExcelForum.com Gamut
    Use Code Tags: Highlight code; click on the # icon above,
    Post screenshots COPYABLE to a Spredsheet; NOT IMAGES PLEASE
    http://www.excelforum.com/the-water-...ml#post4109080
    https://app.box.com/s/gjpa8mk8ko4vkwcke3ig2w8z2wkfvrtv
    http://excelmatters.com/excel-forums/ ( Scrolll down to bottom )

  10. #10
    Forum Expert Doc.AElstein's Avatar
    Join Date
    05-23-2014
    Location
    '_- Germany >Outside Building things.... Mostly
    MS-Off Ver
    Office 2003 2007 2010 PC but Not mac. XP and Vista mostly, sometimes Win 7
    Posts
    3,618

    Re: Multidimensional Array to Single Column Range

    I do not like to use codes I do not understand. Mine is very hard to understand , but if you can you would learn a lot. For the benefit of anyone interested, in this post I explain my Code in full detail, ( For ease of explanation it works on the reduced size data I gave in the first screen shot above.


    So the Explnation of Alan’s codes.
    Code also here:
    http://www.excelforum.com/showthread...10#post4381972

    In words first briefelly.
    To Fully understand , run the code in F8 debug mode, and follow through, the comments and what happens in the Worksheet. Also if you know how set watches on variables ( Highlight variable in code anywhere and hit SHIFT + F9 ), do that and see how they are filled

    In Words.

    The basic idea is to simply use the .Index Function in this form, ( “pseudo code” )

    Output = .Index( Cells , rws(), clms() )

    Cells is the entire spreadsheet Range

    rws()
    and clms() are Arrays containing the spreadsheet row and column number you want starting from the first.

    VBA .Index works in such a form such that it pairs sequentially each row and column number , then gives out the Value at those Spreadsheet co ordinates. This value it adds to the end of an ever increasing internally generated 1 D Array
    VBA has a convention to allow you to paste this “long” Array of values to a Row.
    But you do not want that. So we simply .Transpose that to give you a “deep” column
    ( I would add something in passing here. The .Transpose can be a bit quirky when transposing Values. So you might want to replace it with a simple Function. Such as here
    http://www.excelforum.com/showthread...t=#post4378086
    Note as you are giving a 1 D Array you will need to use the biggest code:
    http://www.excelforum.com/showthread...t=#post4378089
    _....)


    Rem Ref pgc http://www.mrexcel.com/forum/excel-q...-column-2.html
    Rem Ref shg http://www.excelforum.com/tips-and-t...ml#post4214733
    _...........

    So here the code , have fun in going through !!

    Alan

    Sub Alanpgc()    '    http://www.excelforum.com/excel-programming-vba-macros/1138428-multidimensional-array-to-single-column-range.html
    ' Worksheets info.
    Dim ws As Worksheet
    Set ws = ThisWorkbook.Worksheets("pgcArraysSplitToColumn")
    Set ws = Worksheets("pgcArraysSplitToColumn") 'CHANGE TO SUIT YOUR SHEET
    ws.Columns(50).ClearContents ' Remove any data already there, Just to be sure the next lines do any thing
    Dim rngIn As Range, rngOut As Range
    Set rngIn = ws.Range("F21:H23")
    Set rngOut = ws.Range("AX1:AX9")
    ' Hard copied Indicies for rngIn in required series output.
    Dim rws() As Variant, clms() As Variant 'Variant Elements chosen for these Arrays to match type of Elements returned by the mehtods we use below
    Let rws() = Array(1, 1, 1, 2, 2, 2, 3, 3, 3)
    Let clms() = Array(1, 2, 3, 1, 2, 3, 1, 2, 3)
    ' Some maths to get a more flexible solution
        '    Let rws() = Evaluate("int((column(A:I)+(3-1))/3))") ' The Maths is sound here, but you will only get the first value out of an internally made Array
        '    Let clms() = Evaluate("mod((column(A:I)-1),3))+1") ' You need to do a trick which stretches VBA to give out in your "Area" which would enclose all the values VBA has to offer           http://www.mrexcel.com/forum/excel-questions/806702-visual-basic-applications-evaluate-range-vlookup.html?#post3944034
    Let rws() = Evaluate("if(column(A:I),int((column(A:I)+(3-1))/3))") ' if(column(A:I),_______) is one.....
    Let clms() = Evaluate("If(column(A:I),(mod((column(A:I)-1),3))+1)") '..... Trick to return an Array of all VBA has to offer for us in this case
    
    ' We Get a 1 D Range ( "Horizontal ) using .Index which will "paired" each consequtive indicie for "row" , "column" arguments which are Arrays of indicies, and give out consequtively in an "internal" 1 D Array
    Dim rng1D As Range: Set rng1D = Range("AX1:BF1")
    rng1D.ClearContents ' Remove any data already there, Just to be sure the next lines do any thing
    Let rng1D.Value = Application.Index(rngIn, rws(), clms()) 'Returns a 1 D range, like a special 1 D Array ( Note just values here ) ...    http://www.excelforum.com/showthread.php?t=1105617&page=2&p=4380627&highlight=#post4380627
    
    '  We want transpose of our 1 D  " horizontal" "row"
    Let rngOut.Value = Application.Transpose(rng1D)
    
    '   To make more flexible we rewite to work on Cells as the Input range, and deternmine our Columns a bit easier.  ( And miss out the 1 D range bit )
    'New indicies for Cells as Input Range
    Let rws() = Array(21, 21, 21, 22, 22, 22, 23, 23, 23)
    Let clms() = Array(6, 7, 8, 6, 7, 8, 6, 7, 8)
            '    Dim vTemp() As Variant: Let vTemp() = Application.Index(Cells, rws(), clms()): Let rngOut.Value = Application.Transpose(vTemp)
            rng1D.ClearContents: rngOut.ClearContents ' Remove any data already there, Just to be sure the next lines do any thing
    Let rngOut.Value = Application.Transpose(Application.Index(ws.Cells, rws(), clms())) 'This hard copied version works so...
    '...Try to make it more flexible
    Dim TLrw As Long, TLclm As Long, lrws As Long, lclms As Long ' Input range Top Left rows an columns and count of rows and columns         Long is very simple to handle, - final memory "size" type is known (123.456 and 000.001 have same "size" computer memory ) , and so a Address suggestion can be given for the next line when the variable is filled in.  ( Long is a Big whole Number limit (-2,147,483,648 to 2,147,483,647) If you need some sort of validation the value should only be within the range of a Byte/Integer otherwise there's no point using anything but Long.--upon/after 32-bit, Integers (Short) need converted internally anyways, so a Long is actually faster. ).
    Let TLrw = rngIn.Row: Let TLclm = rngIn.Column:  Let lclms = rngIn.Columns.Count: Let lrws = rngIn.Rows.Count
    Dim CntCells As Long: CntCells = lrws * lclms ' Number of cells
    Let rws() = Evaluate("if(column(A:I),int((column(A:I)+(3-1))/3))") 'Original based on Range to be used as first argument in Index
    Let rws() = Evaluate("if(column(A:I),(int((column(A:I)+(3-1))/3))+(21-1))")
    Let rws() = Evaluate("if(column(A:I),(int((column(A:I)+(3-1))/3))+(" & TLrw & "-1))")
    Let rws() = Evaluate("if(column(A:I),(int((column(A:I)+(" & lclms & "-1))/" & lclms & "))+(" & TLrw & "-1))")
    Let rws() = Evaluate("if(column(A:I),(int((column(A:I)+(" & lclms & "-1))/" & lclms & "))+(" & TLrw & "-1))")
     Dim requiredColumnLetter As String: Let requiredColumnLetter = shgMathsVBA(CntCells)
     Let requiredColumnLetter = shgMathsVBA(lrws * lclms)
     Let requiredColumnLetter = shgMathsVBA(rngIn.Rows.Count * rngIn.Columns.Count)
     Let rws() = Evaluate("if(column(A:" & requiredColumnLetter & "),(int((column(A:" & requiredColumnLetter & ")+(" & lclms & "-1))/" & lclms & "))+(" & TLrw & "-1))")
     Let rws() = Evaluate("if(column(A:" & shgMathsVBA(rngIn.Rows.Count * rngIn.Columns.Count) & "),(int((column(A:" & shgMathsVBA(rngIn.Rows.Count * rngIn.Columns.Count) & ")+(" & lclms & "-1))/" & lclms & "))+(" & TLrw & "-1))")
    Let rws() = Evaluate("if(column(A:" & shgMathsVBA(rngIn.Rows.Count * rngIn.Columns.Count) & "),(int((column(A:" & shgMathsVBA(rngIn.Rows.Count * rngIn.Columns.Count) & ")+(" & rngIn.Columns.Count & "-1))/" & rngIn.Columns.Count & "))+(" & TLrw & "-1))")
    Let rws() = Evaluate("if(column(A:" & shgMathsVBA(rngIn.Rows.Count * rngIn.Columns.Count) & "),(int((column(A:" & shgMathsVBA(rngIn.Rows.Count * rngIn.Columns.Count) & ")+(" & rngIn.Columns.Count & "-1))/" & rngIn.Columns.Count & "))+(" & rngIn.Row & "-1))")
    
    Let clms() = Evaluate("If(column(A:I),(mod((column(A:I)-1),3))+1)") 'Original based on Range to be used as first argument in Index
    Let clms() = Evaluate("if(column(A:I),mod(column(A:I)-1,3)+1+(6-1))")
    Let clms() = Evaluate("if(column(A:I),mod(column(A:I)-1,3)+1+(" & TLclm & "-1))")
    Let clms() = Evaluate("if(column(A:I),mod(column(A:I)-1,3)+" & TLclm & ")")
        '    Dim requiredColumnLetter As String: Let requiredColumnLetter = shgMathsVBA(CntCells)
    Let clms() = Evaluate("if(column(A:" & requiredColumnLetter & "),mod(column(A:" & requiredColumnLetter & ")-1,3)+" & TLclm & ")")
    Let clms() = Evaluate("if(column(A:" & shgMathsVBA(CntCells) & "),mod(column(A:" & shgMathsVBA(CntCells) & ")-1,3)+" & TLclm & ")")
    Let clms() = Evaluate("if(column(A:" & shgMathsVBA(CntCells) & "),mod(column(A:" & shgMathsVBA(CntCells) & ")-1," & lclms & ")+" & TLclm & ")")
    Let clms() = Evaluate("if(column(A:" & shgMathsVBA(CntCells) & "),mod(column(A:" & shgMathsVBA(CntCells) & ")-1," & lclms & ")+" & TLclm & ")")
    Let clms() = Evaluate("if(column(A:" & shgMathsVBA(lrws * lclms) & "),mod(column(A:" & shgMathsVBA(lrws * lclms) & ")-1," & lclms & ")+" & TLclm & ")")
    Let clms() = Evaluate("if(column(A:" & shgMathsVBA(lrws * rngIn.Columns.Count) & "),mod(column(A:" & shgMathsVBA(lrws * rngIn.Columns.Count) & ")-1," & rngIn.Columns.Count & ")+" & TLclm & ")")
    Let clms() = Evaluate("if(column(A:" & shgMathsVBA(rngIn.Rows.Count * rngIn.Columns.Count) & "),mod(column(A:" & shgMathsVBA(rngIn.Rows.Count * rngIn.Columns.Count) & ")-1," & rngIn.Columns.Count & ")+" & TLclm & ")")
    Let clms() = Evaluate("if(column(A:" & shgMathsVBA(rngIn.Rows.Count * rngIn.Columns.Count) & "),mod(column(A:" & shgMathsVBA(rngIn.Rows.Count * rngIn.Columns.Count) & ")-1," & rngIn.Columns.Count & ")+" & rngIn.Column & ")")
            rng1D.ClearContents: rngOut.ClearContents ' Remove any data already there, Just to be sure the next lines do any thing
    Let rngOut.Value = Application.Transpose(Application.Index(ws.Cells, rws(), clms()))
    Let rngOut.Value = Application.Transpose(Application.Index(ws.Cells, Evaluate("if(column(A:" & shgMathsVBA(rngIn.Rows.Count * rngIn.Columns.Count) & "),(int((column(A:" & shgMathsVBA(rngIn.Rows.Count * rngIn.Columns.Count) & ")+(" & rngIn.Columns.Count & "-1))/" & rngIn.Columns.Count & "))+(" & rngIn.Row & "-1))"), Evaluate("if(column(A:" & shgMathsVBA(rngIn.Rows.Count * rngIn.Columns.Count) & "),mod(column(A:" & shgMathsVBA(rngIn.Rows.Count * rngIn.Columns.Count) & ")-1," & rngIn.Columns.Count & ")+" & rngIn.Column & ")")))
    
    End Sub
    Rem Ref pgc   http://www.mrexcel.com/forum/excel-questions/908760-visual-basic-applications-copy-2-dimensional-array-into-1-dimensional-single-column-2.html
    Function shgMathsVBA(ByVal lclm As Long) As String '
            '    Dim vtemp
            '    Let vtemp = IIf(((((lclm - 1) \ 26) - 1) \ 26) <> 0, Chr(65 + (((((lclm - 1) \ 26) - 1) \ 26) - 1 Mod 26)), "")
            '    Let vtemp = Evaluate("IF(QUOTIENT(QUOTIENT(" & lclm & "-1, 26)-1, 26), CHAR(MOD(QUOTIENT(QUOTIENT(" & lclm & "-1, 26)-1, 26), 26)-1 + 65), """") ")
            '    Let vtemp = IIf(((lclm - 1) \ 26) <> 0, Chr(65 + (((lclm - 1) \ 26) - 1) Mod 26), "")
            '    Let vtemp = Evaluate("IF(QUOTIENT(" & lclm & "-1, 26), CHAR(MOD(QUOTIENT(" & lclm & "-1, 26)-1, 26) + 65), """")")
            '    Let vtemp = IIf(lclm <> 0, Chr(65 + (lclm - 1) Mod 26), "")
            '    Let vtemp = Evaluate("IF(" & lclm & ", CHAR(MOD(" & lclm & "-1, 26) + 65), """") & """"")
            '    Let FucshgMathsVBA = IIf(((((lclm - 1) \ 26) - 1) \ 26) <> 0, Chr(65 + (((((lclm - 1) \ 26) - 1) \ 26) - 1 Mod 26)), "") & IIf(((lclm - 1) \ 26) <> 0, Chr(65 + (((lclm - 1) \ 26) - 1) Mod 26), "") & IIf(lclm <> 0, Chr(65 + (lclm - 1) Mod 26), "")
    Let shgMathsVBA = IIf(((((lclm - 1) \ 26) - 1) \ 26), Chr(65 + (((((lclm - 1) \ 26) - 1) \ 26) - 1 Mod 26)), "") & IIf(((lclm - 1) \ 26), Chr(65 + (((lclm - 1) \ 26) - 1) Mod 26), "") & IIf(lclm, Chr(65 + (lclm - 1) Mod 26), "")
            '    Let FucshgMathsVBA = Evaluate("IF(QUOTIENT(QUOTIENT(" & lclm & "-1, 26)-1, 26), CHAR(MOD(QUOTIENT(QUOTIENT(" & lclm & "-1, 26)-1, 26)-1, 26) + 65), """") & IF(QUOTIENT(" & lclm & "-1, 26), CHAR(MOD(QUOTIENT(" & lclm & "-1, 26)-1, 26) + 65), """") & IF(" & lclm & ", CHAR(MOD(" & lclm & "-1, 26) + 65), """") & """"")
    End Function
    Rem Ref shg   http://www.excelforum.com/tips-and-tutorials/1108643-vba-column-letter-from-column-number-explained.html#post4214733
    Last edited by Doc.AElstein; 05-09-2016 at 12:12 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 03-07-2016, 09:54 PM
  2. storing variable single column range into array
    By Prokis in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-22-2013, 09:38 AM
  3. Using the ReDim array function in a multidimensional array in excel
    By Doruli in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-05-2012, 01:43 PM
  4. Replies: 2
    Last Post: 08-16-2012, 01:41 PM
  5. [SOLVED] Paste Multidimensional Array into 1 Range Column
    By mcclanat in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-07-2012, 07:58 PM
  6. Replies: 3
    Last Post: 03-28-2012, 05:59 PM
  7. Multidimensional array
    By gwithey in forum Excel Programming / VBA / Macros
    Replies: 31
    Last Post: 02-02-2009, 12:15 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1