+ Reply to Thread
Results 1 to 14 of 14

Populating array data in column

  1. #1
    Forum Contributor
    Join Date
    05-13-2019
    Location
    Halifax, Canada
    MS-Off Ver
    2016
    Posts
    138

    Populating array data in column

    Hi all,

    I have stored 5 data in the array and I can populate them on row by the following code:

    Please Login or Register  to view this content.
    I am trying to learn to populate them in A1:A5. What changes do I have to make to get the result?

    I appreciate your advice.

    Thank you
    Roshan
    Last edited by Roshan.Shakya; 12-08-2019 at 08:15 PM. Reason: sub procedure name changed

  2. #2
    Forum Contributor
    Join Date
    05-13-2019
    Location
    Halifax, Canada
    MS-Off Ver
    2016
    Posts
    138

    Re: Populating array data in column

    Sorry there was a slight error (A1:A5). It should be A1:E1 (in the code). I am trying to learn how to populate array in column. I have edited now.

  3. #3
    Valued Forum Contributor
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    688

    Re: Populating array data in column

    Change the name of your macro... you cannot use a VB function's name for the name of a procedure.
    Last edited by Rick Rothstein; 12-08-2019 at 08:03 PM.

  4. #4
    Forum Contributor
    Join Date
    05-13-2019
    Location
    Halifax, Canada
    MS-Off Ver
    2016
    Posts
    138

    Re: Populating array data in column

    Thank you Rick. I got you.

  5. #5
    Forum Contributor
    Join Date
    05-13-2019
    Location
    Halifax, Canada
    MS-Off Ver
    2016
    Posts
    138

    Re: Populating array data in column

    Rick it worked. Did you remove your code?

  6. #6
    Valued Forum Contributor
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    688

    Re: Populating array data in column

    Quote Originally Posted by Roshan.Shakya View Post
    Did you remove your code?
    The code I posted and removed just showed that you could eliminate the variable and do everything in one line of code...
    Please Login or Register  to view this content.
    I removed it because it really had nothing to do with your original question.

  7. #7
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013
    Posts
    15,239

    Re: Populating array data in column

    Quote Originally Posted by Roshan.Shakya View Post
    I am trying to learn to populate them in A1:A5. What changes do I have to make to get the result?
    2 ways
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    05-13-2019
    Location
    Halifax, Canada
    MS-Off Ver
    2016
    Posts
    138

    Re: Populating array data in column

    That worked for me. I used that code. Anyway thanks. I was learning to populate in column.

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013
    Posts
    15,239

    Re: Populating array data in column

    Quote Originally Posted by Roshan.Shakya View Post
    I was learning to populate in column.
    So, I have posted the codes.

  10. #10
    Forum Contributor
    Join Date
    05-13-2019
    Location
    Halifax, Canada
    MS-Off Ver
    2016
    Posts
    138

    Re: Populating array data in column

    Thanks jindon for the code,

    it worked with changes (Range("A1:A5") instead of [A1:A5].

    Roshan

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013
    Posts
    15,239

    Re: Populating array data in column

    It's working as it is here, though...

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  12. #12
    Valued Forum Contributor
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 2010
    Posts
    688

    Re: Populating array data in column

    Quote Originally Posted by Roshan.Shakya View Post
    Thanks jindon for the code,

    it worked with changes (Range("A1:A5") instead of [A1:A5].
    You should not have had to change jindon's code... it is correct as written (he used a shortcut notation which your version of Excel should have no trouble recognizing). I am guessing from your last message that you noticed that jindon answered your originally posted message for filling in cells A1:A5 and not cells A1:E1 which you amended your request for in Message #2.

  13. #13
    Forum Contributor
    Join Date
    05-13-2019
    Location
    Halifax, Canada
    MS-Off Ver
    2016
    Posts
    138

    Re: Populating array data in column

    Thank you both of you. It is a very good learning. Actually i made mistake on my original post and i edited to rectify. Sorry for the confusion. And yes jindonís code worked.

  14. #14
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013
    Posts
    15,239

    Re: Populating array data in column

    Although I used the short cut notation of Evaluate method for a Range object, I would recommend Range, as there's no advantage of using it.
    And more, you can not use the benefit of intelisence.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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