+ Reply to Thread
Results 1 to 16 of 16

Issues with merge script

  1. #1
    Registered User
    Join Date
    11-13-2012
    Location
    Italia
    MS-Off Ver
    Excel 2007
    Posts
    11

    Issues with merge script

    I got something that doesn't work with this script.
    It Open a directory with several xlsx files, copy them in one file and close 'em.
    The line underliend SHOULD select the last column just copied and move to the first column of the file they've copied in, but it returns No Object error.

    Any help?

    Please Login or Register  to view this content.

    Thanks

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645
    Column returns the column number which isn't an object.

    You could replace it with EntireColumn but that will only work if you are copying to row 1.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    11-13-2012
    Location
    Italia
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Issues with merge script

    Any clue how to move the last column of the cells block just copied in (or better i can "ask" to read the column header and depending if it return me it's the one i'm looking for, chose that one) and move at the first sheet column?

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Issues with merge script

    Sorry I'm not sure I follow.

    Where exactly are you copying the data to?

  5. #5
    Registered User
    Join Date
    11-13-2012
    Location
    Italia
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Issues with merge script

    I have several excel files in a directory.
    The script open each, copy the content and paste in a singular sheet, consequentially.
    Each time it copy a file i would like to read the header of the cells copied, find the header "codici" which is not always in the same column, select the column with that header, hust copied and move in the 1st column of the sheet they're copied in (or if it's easyer in a new sheet)

    Is it possible?

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Issues with merge script

    But where exactly are you copying to?

    Do you copy the data from each file to a separate column?

    Where will the header 'codici' be located? Is the more than one for each header?

  7. #7
    Registered User
    Join Date
    11-13-2012
    Location
    Italia
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Issues with merge script

    Each file i open contain a table with 2-3-4-5 columns, one of these columns header is "Codici".
    The script open the file, copy all the table and paste into the new file.
    It paste starting from the last row+1 of the previus table copied.
    So i've a sheet with several different tables copied one under the last row of the previus one.
    I would like for each table, move the column "Codici" at the column A of the sheet i'm coping the table into..

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Issues with merge script

    What is this line of code meant to do?
    Please Login or Register  to view this content.
    It appears to be copying the last column of data in WS2 to column 1 below existing data.

    Could you attach a workbook with some sample data?

    Perhaps that will help clarify things.

  9. #9
    Registered User
    Join Date
    11-13-2012
    Location
    Italia
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Issues with merge script

    Quote Originally Posted by Norie View Post
    What is this line of code meant to do?
    Please Login or Register  to view this content.
    It appears to be copying the last column of data in WS2 to column 1 below existing data.

    Could you attach a workbook with some sample data?

    Perhaps that will help clarify things.
    The one you quote is what doesn't work.. I expected it move the last column i just copied in to the 1st column but it does not..
    I'm going to paste an example, give me a minute to access the pc i'm working on.

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Issues with merge script

    Why do you want to move the last column?

    Isnt't the codici column you want to move?

  11. #11
    Registered User
    Join Date
    11-13-2012
    Location
    Italia
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Issues with merge script

    That's an example with 2 files copied..
    I would like to read that, in first part it find the column C is the one with header "CODICE" and move at the column A, and going on if can read the header "CODICE" is in the column D and then move the column D to the column A and so on.. Understandable?

    Please Login or Register  to view this content.
    (The dots have no header, but they're in a column)

  12. #12
    Registered User
    Join Date
    11-13-2012
    Location
    Italia
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Issues with merge script

    Quote Originally Posted by Norie View Post
    Why do you want to move the last column?

    Isnt't the codici column you want to move?
    Yes, it usually is the last column, but there're some case it's not.. so would be better select it through header.

  13. #13
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Issues with merge script

    Attaching a workbook is better than posting data.

  14. #14
    Registered User
    Join Date
    11-13-2012
    Location
    Italia
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Issues with merge script

    here it is
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    11-13-2012
    Location
    Italia
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Issues with merge script

    Is it ok? Sorry my english sucks..

  16. #16
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Issues with merge script

    satomma

    It's me that should be apologising for not getting back to you sooner.

    I did look at the file and it helps a bit but it's still not 100% clear what you want to do.

    Is the date in the file an example of the data in the files you are opening?

    If it is how exactly would it be copied into the workbook destination file?

    One thing I didn't quite get was what you are trying to do with the CODICE column(s).

    Would the CODICE column be moved in front of the POS. column?

+ 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