+ Reply to Thread
Results 1 to 3 of 3

Making Columns Dynacmic

  1. #1
    Forum Contributor
    Join Date
    08-23-2010
    Location
    Staten Island, NY
    MS-Off Ver
    Excel 2003
    Posts
    242

    Making Columns Dynacmic

    I have an addin that people at my company use to run reports. They download the data out of our database application and then design a report it many ways using my add-in. However, there is an issue that if the programers of the database application move a column, add a column, or delete a column they break my program completely. Now, I want to make everything dynamic in order to mitigate these problems.

    Here is the code I am trying to make:

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    There is two issues with this code. First, since I add columns and delete columns with this it will not work correctly because the loop is a set size once it starts. How do I get the loop to change in size depending on adding and removing columns? Second the fnAddToArray will only work if the Array has two or more labels in it already. I addded the 'arrayBlank' just recently because I realized that it was crashing when it is blank. However, when only one item is in there it is not an Array so it still crashes and goes to arrayBlank. How do I fix this issue?

    Thank you in advance.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    12,966

    Re: Making Columns Dynacmic

    I don't quite get what you are doing, but you could load the column headers into an array and use that array to populate a combobox list to pick from.
    Please Login or Register  to view this content.
    Ben Van Johnson

  3. #3
    Forum Contributor
    Join Date
    08-23-2010
    Location
    Staten Island, NY
    MS-Off Ver
    Excel 2003
    Posts
    242

    Re: Making Columns Dynacmic

    That will not work at all for what I am doing. What I am doing is looking at the column headers and performing specific actions on the columns. Certain columns need to be deleted and others need a column added after them. So reading them in will not do. I need to read one column heading at a time and decide on on what to do. That is why I said I need to fix those two issues:

    There is two issues with this code. First, since I add columns and delete columns with this it will not work correctly because the loop is a set size once it starts. How do I get the loop to change in size depending on adding and removing columns? Second the fnAddToArray will only work if the Array has two or more labels in it already. I addded the 'arrayBlank' just recently because I realized that it was crashing when it is blank. However, when only one item is in there it is not an Array so it still crashes and goes to arrayBlank. How do I fix this issue?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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