+ Reply to Thread
Results 1 to 11 of 11

Consolidation not working when moving file!!

  1. #1
    Registered User
    Join Date
    02-18-2014
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    7

    Consolidation not working when moving file!!

    Hi guys,

    First time poster looking for help!

    I am very basic when it comes to excel and have recorded a macro to consolidate data on a spreadsheet. The problem I am having is I want to move the source (orginal) file from my desktop to the shared drive at work so other people can open and use the macro. When I move the excel spreadsheet and try to run the macro I get this message: 'Cannot open consolidation source file' It then has the file name and the worksheet name.

    I can then click ok and cancel. When clicking cancel I get the following message: Runtime error 1004 Consolidate method of range class failed. If I move it back to the desktop it works again (but only for me).

    Any help would be much appreciated!!!



    Below I have included the very first bit of the macro code (I couldn't include all of it as it exceeds the character limit)
    Please Login or Register  to view this content.
    Last edited by flexn; 02-18-2014 at 02:54 AM.

  2. #2
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: Consolidation not working when moving file!!

    Hi Shaun,

    Not much to go on here, but I note that all the files you are accessing are on your C drive. Once you move the macro to the S drive (my assumption there for the shared drive), your macro will not be able to find the files. You need to have them on the same computer - preferably in the same folder.

    Having said that, the code doesn't seem to be very efficient! Lots of scrolling. What are you trying to achieve? You seem to be trying to add together the value in several columns on row 56 of the same sheet.

    This is quick and nasty, but assuming you want to put the consolidated data in H56 of the sheet with the macro, and get the value from the other sheet, this should do it a bit more efficiently.

    NOT TESTED. You may have to tweek it a bit, bit have a go and see how it works.

    Please Login or Register  to view this content.

    Regards,

    David

    Please remember, your request is clearer if you attach a sample workbook.
    - Click on Go Advanced and click on the Paper Clip.
    When you reply please make it clear WHO you are responding to by mentioning their name.
    If this has been of assistance, please advise. A little thanks goes a long way.
    - Please click on the *Add Reputation button at the bottom of helpful responses.
    Please mark your thread as SOLVED:
    - Click Thread Tools above your first post, select "Mark your thread as Solved".

  3. #3
    Registered User
    Join Date
    02-18-2014
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Consolidation not working when moving file!!

    David,

    Thanks for your reply.

    The code is very messy and there is lots of scrolling because I manually made this macro by using the record macro feature as I'm still learning excel. However it works perfectly for what I need. (only on my PC though!)

    Basically what I am trying to do is work related. It is hard to explain but I will give it a shot:

    I get a excel spreadsheet with a heap of data that contains lengths of material that needs to be cut, in this case metal tube. It has to be manipulated so it can go out in to the factory for the machine. Also note that every sheet I get sent to me is different. It can be up to 50 rows and 50 columns worth so doing it manually would take forever (which is what I did the first time to record the macro). Now what I need to do is separately consolidate each column to eliminate any duplicates so I don't have a certain length appearing 10 times, but instead only once with the the quantity of 10.

    It has to be consolidated in to separate columns as the they material has markings. For example I get a heap of sizes with the markings W1, then another lot W2 etc. So these then become the different columns that need separate consolidating.

    I hope that made sense

    So is there anyway to change the source of where the macro runs from so I can move it to the shared drive? I can also insert the full code....lots of scrolling though as what I showed before was only part of it.

    Thanks heaps

  4. #4
    Registered User
    Join Date
    02-18-2014
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Consolidation not working when moving file!!

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-18-2014
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Consolidation not working when moving file!!

    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: Consolidation not working when moving file!!

    Shaun,

    If you can attach an example of the workbook you are trying to pull data from it would help.

    I assume the macro you recorded is within the sheet you are trying to consolidate from!

    What is it you are looking for as you scroll around?

    Please attach the workbook, and give some explanation. I think the number of lines in the macro can be dramatically reduced.

    For the macro to work properly, it should be in a separate workbook so that it can work with all the different files you said you receive.

    David

    Please remember, your request is clearer if you attach a sample workbook.
    - Click on Go Advanced and click on the Paper Clip.
    When you reply please make it clear WHO you are responding to by mentioning their name.
    If this has been of assistance, please advise. A little thanks goes a long way.
    - Please click on the *Add Reputation button at the bottom of helpful responses.
    Please mark your thread as SOLVED:
    - Click Thread Tools above your first post, select "Mark your thread as Solved".

  7. #7
    Registered User
    Join Date
    02-18-2014
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Consolidation not working when moving file!!

    Hi david,
    I will attach a copy in about an hour when i get to work.

    As for the scrolling what I am doing is selecting the cell where i want the data to go into, which is further down the page, then scrolling up to select the data I want consolidated. So I am guessing all those lines can be deleted as they would have no use in the macro?

    What I do is copy the data I get sent to me and paste it in the spreadsheet that contains the macro as I have set up a template on the sheet containing the macro so it works smoothly when extracting the data.

    Will get back to you with a copy asap.

    Thanks
    Shaun
    Last edited by flexn; 02-18-2014 at 08:48 PM.

  8. #8
    Registered User
    Join Date
    02-18-2014
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Consolidation not working when moving file!!

    ROLL FORM PROGRAM.xlsm

    Here is the workbook attached David.

    Just wondering if there is a way I can move the source file to the shared drive so it can be accessed by all computers?

    Thanks
    Shaun

  9. #9
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: Consolidation not working when moving file!!

    Thanks Shaun,

    I can run all your macros, but they don't appear to be doing anything!

    Since there is no data in the model you sent, I can't see what you're trying to achieve.

    None of the buttons seem to do anything.

    Can you send a completed file that has worked so that I can see what you're doing?

    Thanks,

    David

  10. #10
    Registered User
    Join Date
    02-18-2014
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Consolidation not working when moving file!!

    Hi David,
    Thanks for your help, I managed to figure it out. I just had to change the source in every line from this:

    Selection.Consolidate Sources:= _
    "'C:\Users\shaun.jones\Desktop\[ROLL FORM PROGRAM.xlsm]14519 - 75x40x1.6 CYCLONIC STUD'!R2C132:R50C133" _
    , Function:=xlSum, TopRow:=False, LeftColumn:=True, CreateLinks:=False

    To my shared drive where the new file is:

    Selection.Consolidate Sources:= _
    "'S\CI\[ROLL FORM PROGRAM.xlsm]14519 - 75x40x1.6 CYCLONIC STUD'!R2C132:R50C133" _
    , Function:=xlSum, TopRow:=False, LeftColumn:=True, CreateLinks:=False

    Just a quick question, can I delete all those lines that are just scrolling?

  11. #11
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: Consolidation not working when moving file!!

    Shaun,

    In answer to your question. YES. I believe you can delete all the scroll lines, they are just recording arrow key use or mouse clicks.

    Well done! That is virtually what I had to do to test it.

    I distracted myself in trying to get a better macro than the recorded version.


    If you want to make some improvements, get in touch.

    All the best!

    David


    When you reply please make it clear WHO you are responding to by mentioning their name.

    If this has been of assistance, please advise. A little thanks goes a long way.
    - Please click on the *Add Reputation button at the bottom of helpful responses.

    Please mark your thread as SOLVED:
    - Click Thread Tools above your first post, select "Mark your thread as Solved".

+ 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] open variably named file, copy/paste data into consolidation file, open next file in list
    By sllawrence1968 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-29-2012, 09:49 PM
  2. Replies: 1
    Last Post: 08-18-2012, 09:32 AM
  3. Date display issues in Consolidation File
    By dimitrz in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-27-2009, 03:32 AM
  4. File Search Consolidation
    By LJO in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-09-2008, 09:49 PM
  5. File consolidation
    By Jonl in forum Excel General
    Replies: 1
    Last Post: 08-08-2005, 02:07 PM

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