+ Reply to Thread
Results 1 to 2 of 2

Make VBR independent of column order in data table, output results in non-adjacent columns

  1. #1
    Forum Contributor
    Join Date
    08-20-2011
    Location
    Oslo
    MS-Off Ver
    MS 365
    Posts
    245

    Make VBR independent of column order in data table, output results in non-adjacent columns

    Hi!

    I have a VBA code that I need to modify and would appreciate some help on that.

    The code fetches some data from a worksheet named “dws” and then reorganizes those data in a worksheet named “ows”.

    The first five columns in the worksheet “dws” are used to get the data, along with some criteria in a worksheet named “mws”.

    The name of the first five columns in “dws” are as follows:

    Batch, Batch2, Material, Filter Code, Deleted

    The name of the three first columns in "mws" are as follows:

    solDict, halbDict, packDict

    The code addresses the column “Deleted” by name but addresses the other columns by use of the Offset function. However, the order and placement of these columns in “dws” may change from time to time and this would cause the code to stop working because of the way these columns are addressed.

    The data worksheet “dws” may reside within the same workbook as the output worksheet “ows” but will most often reside in a separate workbook at a different address.

    The data that is fetched from “dws” will eventually be pasted in the columns N, O and P in the worksheet “ows”, starting in cell N9.

    I would appreciate help on the following three items:

    1. Make the code independent of the placement of the columns in “dws” and "mws" by using each individual column name, like has been done for the column “Deleted”.

    2. Make the code look for filepath and filename in cell A1 of the output worksheet “ows”, so that this can be changed easily.

    3. Make the code output the data in the non-adjacent columns N, R and V instead of the adjacent columns N, O and P, but still starting at the ninth row as it already does.


    Here is the code:

    Please Login or Register  to view this content.
    I have attached a workbook that includes the code and some data so you can see how it presently works.

    The file path needs to be written correctly in the code before it can be executed:

    Please Login or Register  to view this content.
    Best regards,
    Marbleking
    Last edited by Marbleking; 08-29-2020 at 03:12 PM.

  2. #2
    Forum Contributor
    Join Date
    08-20-2011
    Location
    Oslo
    MS-Off Ver
    MS 365
    Posts
    245

    Re: Make VBR independent of column order in data table, output results in non-adjacent col

    Hello,

    Can someone please take a look at this?

    Regards,
    Marbleking

+ 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: 4
    Last Post: 05-24-2020, 12:26 AM
  2. [SOLVED] Copy across 9 columns of source data into 9 columns of an output table
    By nunez100 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 01-29-2019, 10:19 AM
  3. How to make a Independent pane of other rows and columns?
    By Amin Jalili in forum Excel General
    Replies: 0
    Last Post: 05-28-2017, 03:00 AM
  4. summary excel table for output results based on multiple choice input data
    By dargonaro in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-25-2017, 06:26 PM
  5. Sort Descending & back to Original Order - Two independent data sets
    By hennakao in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-22-2017, 07:36 AM
  6. Replies: 7
    Last Post: 04-23-2014, 10:45 AM
  7. Sequence numbers based on date and independent of column sort order
    By bedepe in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 02-21-2014, 07:32 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