Results 1 to 4 of 4

Thread: From array to sheet

  1. #1
    Board Regular
    Join Date
    Dec 2004
    Location
    Florida
    Posts
    133
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question From array to sheet

    I run the code below to fill sheet with data from an array. It takes a long time to finish when the ubound(shtdata_new,1) is only 40 and ubound(shtdata_new,2) is only 44. Is there a faster way to do this?

    Code:
     'Selecting first row on sheet
        Range("A1").Select
        
        'Copying data from array to worksheet
        For i = LBound(Shtdata_new, 1) To UBound(Shtdata_new, 1)
            For j = LBound(Shtdata_new, 2) To UBound(Shtdata_new, 2)
                ActiveCell.Offset(i, j).Value = Shtdata_new(i, j)
            Next j
        Next i

  2. #2
    Board Regular DanteAmor's Avatar
    Join Date
    Dec 2018
    Location
    México
    Posts
    6,261
    Post Thanks / Like
    Mentioned
    72 Post(s)
    Tagged
    14 Thread(s)

    Default Re: From array to sheet

    Try this

    Change your code for this line

    Code:
    Range("A1").Resize(UBound(Shtdata_new, 1), UBound(Shtdata_new, 2)).Value = Shtdata_new
    Regards Dante Amor

  3. #3
    Board Regular
    Join Date
    Dec 2004
    Location
    Florida
    Posts
    133
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: From array to sheet

    Quote Originally Posted by DanteAmor View Post
    Try this

    Change your code for this line

    Code:
    Range("A1").Resize(UBound(Shtdata_new, 1), UBound(Shtdata_new, 2)).Value = Shtdata_new
    Thanks! this worked like a charm!

  4. #4
    Board Regular DanteAmor's Avatar
    Join Date
    Dec 2018
    Location
    México
    Posts
    6,261
    Post Thanks / Like
    Mentioned
    72 Post(s)
    Tagged
    14 Thread(s)

    Default Re: From array to sheet

    Quote Originally Posted by abenitez77 View Post
    Thanks! this worked like a charm!
    I'm glad to help you. Thanks for the feedback.
    Regards Dante Amor

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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