+ Reply to Thread
Results 1 to 3 of 3

Table only displays last value from arrray

Hybrid View

  1. #1
    Registered User
    Join Date
    06-22-2021
    Location
    New York
    MS-Off Ver
    2019
    Posts
    3

    Table only displays last value from arrray

    I am having trouble displaying each array value into the table. I have tried multiple methods and it always fills the column or row with just the last value of the array. This is what I currently have.

     Application.CutCopyMode = False
        ActiveSheet.ListObjects.Add(xlSrcRange, Range("A" & 17 & ":K" & SECT + 17), , xlNo).Name = "Table"
        ActiveSheet.ListObjects("Table").HeaderRowRange(1) = "SEGMENT"
        ActiveSheet.ListObjects("Table").HeaderRowRange(2) = "HEIGHT COEFFICIENT"
        ActiveSheet.ListObjects("Table").HeaderRowRange(3) = "WIND PRESSURE"
        ActiveSheet.ListObjects("Table").HeaderRowRange(4) = "LENGTH OF SEG"
        ActiveSheet.ListObjects("Table").HeaderRowRange(5) = "AVG.DIA OF POLE"
        ActiveSheet.ListObjects("Table").HeaderRowRange(6) = "AREA OF SEGMENT"
        ActiveSheet.ListObjects("Table").HeaderRowRange(7) = "DRAG COEFFICIENT"
        ActiveSheet.ListObjects("Table").HeaderRowRange(8) = "G"
        ActiveSheet.ListObjects("Table").HeaderRowRange(9) = "WIND FORCE"
        ActiveSheet.ListObjects("Table").HeaderRowRange(10) = "DIST TO CENT"
        ActiveSheet.ListObjects("Table").HeaderRowRange(11) = "BENDING MOMENT"
    
    
    Dim c, Q As Integer
    For c = 0 To BOUND
    For Q = 1 To BOUND + 1
    
    ActiveSheet.ListObjects("Table").DataBodyRange(1, Q) = CH(c)
    ActiveSheet.ListObjects("Table").DataBodyRange(2, Q) = L(c)
    ActiveSheet.ListObjects("Table").DataBodyRange(3, Q) = AVGDIA(c)
    ActiveSheet.ListObjects("Table").DataBodyRange(4, Q) = A(c)
    ActiveSheet.ListObjects("Table").DataBodyRange(5, Q) = CD(c)
    ActiveSheet.ListObjects("Table").DataBodyRange(6, Q) = WP(c)
    ActiveSheet.ListObjects("Table").DataBodyRange(7, Q) = LC(c)
    ActiveSheet.ListObjects("Table").DataBodyRange(8, Q) = MOM(c)
    
    Next Q
    Next c
    I feel like the solutions is very simple yet I can't see it.Any help is appreciated
    Last edited by Glenn Kennedy; 06-24-2021 at 10:51 AM.

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Table only displays last value from arrray

    I have edited your post. Please read Rule 2 to see why...

    https://www.excelforum.com/forum-rul...rum-rules.html
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,998

    Re: Table only displays last value from arrray

    You're overwriting the same cells every time, so you only end up with the last value from each array.
    Everyone who confuses correlation and causation ends up dead.

+ 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: 5
    Last Post: 06-09-2014, 05:39 PM
  2. Replies: 2
    Last Post: 02-12-2014, 01:12 PM
  3. Arrray Index
    By paul290603 in forum Excel General
    Replies: 5
    Last Post: 03-30-2010, 09:36 AM
  4. How to return the first non-zero member in an arrray?
    By swk98s17 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-13-2007, 12:35 AM
  5. Replies: 2
    Last Post: 06-29-2006, 02:00 AM
  6. [SOLVED] help with arrray formula
    By Gary Keramidas in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-13-2005, 02:05 AM

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