Results 1 to 15 of 15

Remove Blank Entries From a 2-D Array

Threaded View

  1. #1
    Registered User
    Join Date
    10-02-2017
    Location
    New Jersey
    MS-Off Ver
    2013
    Posts
    15

    Remove Blank Entries From a 2-D Array

    Hello -

    Thank you in advance for any help regarding this topic.

    I have a 2-D array initialized in my code with variable row and column counts. Within that array there are rows which begin with an empty entry. I cannot modify the input, so I am forced to remove the rows which begin with an empty entry from the array.

    My first attempt at a solution I created a second 2-D array with the same dimensions as the first 2-D array. I then used nested for-loops to traverse the first array and used an if statement to only add to the second array if the entry was non-empty. I thought this would work, but it still had the empty rows.

    For q = 1 To NumRows1
     For r = 1 To NumCols1
       If Result(q, r) = "" Then
       Else
        Result_NoBlanks(q, r) = Result(q, r)
       End If
      Next
    Next
    Any help on this would be greatly appreciated. I'm surprised I could not find a cookie cutter function online. This just seems like an exercise in traversing an array and removing entries, but I am struggling.

    Thank you.

    EDIT: To clarify a potential question, if a row in the array begins with an empty entry then the entire row will be empty.

    EDIT2: By the way this is all being done with an Excel VBA sub with a 2-D variant array.
    Last edited by Altec103; 10-03-2017 at 06:28 AM.

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: 06-15-2014, 11:31 AM
  2. [SOLVED] Concatenate If Blank - remove blank line if first cell is blank
    By ker9 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-27-2014, 02:14 PM
  3. Remove blank entries from data validation list
    By Icarus in forum Excel General
    Replies: 7
    Last Post: 11-08-2012, 01:56 AM
  4. Need VBA code to remove entries if there are duplicates (remove them totally)
    By BrandonFromSingapore in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-13-2012, 12:50 AM
  5. Consolidate Array to Remove Blank/Zero
    By gsurge in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-17-2011, 08:55 AM
  6. removing blank entries from an array
    By TheIrishThug in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-19-2005, 05:34 PM

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