+ Reply to Thread
Results 1 to 3 of 3

How can I make the code move a column to the right with each loop of my data range?

  1. #1
    Registered User
    Join Date
    04-09-2018
    Location
    Boston, MA, US
    MS-Off Ver
    2016
    Posts
    1

    How can I make the code move a column to the right with each loop of my data range?

    Hello,

    I must create a master data base from (thousands of) identical closed files within several sub folders. I want to reference ~20 of the same cells throughout the files, having the file names listed vertically and the corresponding data for each file listed horizontally across the row. I have found most of the following code online and it works in accessing the closed files. However, it lists the data vertically (and repeats the file name vertically). Any help you can provide would be much appreciated. Thank you!

    Please Login or Register  to view this content.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,451

    Re: How can I make the code move a column to the right with each loop of my data range?

    Hi asf and welcome to the forum,

    Because you have lots of files and in folders, I'd suggest you try "Get & Transform" to pull your data together instead of VBA.

    https://support.office.com/en-us/art...9-c6d29cb8df6a
    http://excelunplugged.com/2015/02/10...n-power-query/
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    2,315

    Re: How can I make the code move a column to the right with each loop of my data range?

    Quote Originally Posted by asf612 View Post
    ... I have found most of the following code ... and it works ...
    ? Does this work for sure in any way ?
    Please Login or Register  to view this content.
    "*.xlsx*" => ? What's this ?

    Please Login or Register  to view this content.
    No, this is not adding a new workbook (with one worksheet)

    Please Login or Register  to view this content.
    1. Ok, but ... in what situation it may fail (this assigning to an object: "Set sourceRange") ?
    Each workbook, that has a worksheet #1, also has the scope/range of "E18:E23" in it (and any other range within the cells of the sheet).
    Does this mean, that there are e.g. charts in workbooks, that can be in the first position ?

    2. This above ("sourceRange.Columns.Count >= BaseWks.Columns.Count") can only be at most equal, but not larger, because "BaseWks.Columns.Count" is all columns in the worksheet => because "Set BaseWks = ActiveWorkbook.ActiveSheet"

    Please Login or Register  to view this content.
    16384 columns ? What for ?


    I understand that it is adaptation of the code to your needs, but does it work as it should ?

    Quote Originally Posted by asf612 View Post
    ... I want to reference ~20 of the same cells throughout the files, having the file names listed vertically and the corresponding data for each file listed horizontally across the row ...
    Maybe an example ?

+ 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. [SOLVED] How do I use a LOOP or COUNTER to move down a column of data one row at a time?
    By Tom T Hall in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-06-2017, 11:23 AM
  2. [SOLVED] For Loop to move Rows(B:D) Data to Single Column Consecutively. Code not working.
    By unit285 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-14-2017, 03:07 PM
  3. [SOLVED] Loop rows and make a Range null if criteria met in defined Column
    By KEDENNIS in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-03-2016, 09:55 AM
  4. [SOLVED] code for userform to delete combo box value from dynamic range & move column up
    By HeyInKy in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 09-02-2014, 07:42 PM
  5. Loop through sheets copy column move to end of data
    By apunc1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-30-2013, 11:49 AM
  6. How do I make my macro insert/paste code in specific column range?
    By Rabbitstew in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-17-2012, 04:33 PM
  7. [SOLVED] Make a loop to Find a value then move a row of cells
    By Bill F in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-08-2006, 09:20 AM

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