+ Reply to Thread
Results 1 to 12 of 12

Copy process result from one file to another

  1. #1
    Registered User
    Join Date
    03-23-2011
    Location
    Madagascar
    MS-Off Ver
    Excel 2003
    Posts
    13

    Copy process result from one file to another

    Hi,

    I want to copy automatically the result of the process done on workbook wb2 to workbook wb1 which contain the macro code.
    Here is my sample code:

    Please Login or Register  to view this content.
    On this code, I check the first empty cell in column C inside wb1, in order to identify the row number for the copy.
    Then I count row numbers which verify criterias in COUNTIFS on wb2 and write the result in wb1 but I got error.
    What is wrong with code please?

    Any help will be appreciated.
    Thanks in advance.
    Last edited by hary.mada; 04-22-2011 at 03:18 AM.

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Copy process result from one file to another

    Please Login or Register  to view this content.



  3. #3
    Registered User
    Join Date
    03-23-2011
    Location
    Madagascar
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Copy process result from one file to another

    Quote Originally Posted by snb View Post
    Please Login or Register  to view this content.
    Hi,

    Thank you for this reply.

    Could you please explain me the action of this code as I'm new in macro?
    When I run it, i get the result in file2.xls instead of in workbook wb1 as I mentioned in my previous post. The column is correct but not in the right workbook.
    Also the result value is wrong, instead of 11581 I got 40603, where is the criteria inside the COUNTIFS of my code?
    How to do to put the code inside grey space as yours in this forum?
    Excuse me for this too many question!

    Hary.

  4. #4
    Registered User
    Join Date
    03-23-2011
    Location
    Madagascar
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Copy process result from one file to another

    Hi,

    Any help please?

    Thanks in advance.
    Hary.

  5. #5
    Registered User
    Join Date
    03-23-2011
    Location
    Madagascar
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Copy process result from one file to another

    Hi,

    I need help from someone who can resolve my problem.
    Please, share me your knowledge as i'm new with excel macro.

    Thanks in advance.
    Hary.

  6. #6
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Copy process result from one file to another

    Hi hary.mada

    The formula in R1C1 would be
    Please Login or Register  to view this content.
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  7. #7
    Registered User
    Join Date
    03-23-2011
    Location
    Madagascar
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Copy process result from one file to another

    Quote Originally Posted by pike View Post
    Hi hary.mada

    The formula in R1C1 would be
    Please Login or Register  to view this content.
    Hi Pike,

    Thank you for your reply.

    Here is my code using your proposition:

    Please Login or Register  to view this content.
    but when I run it, File2.xls is open first by the programm then it ask me also to browse the excel file.
    when I choose File2.xls, it ask me to pricise also the worksheet and at the end I got:

    Please Login or Register  to view this content.
    in the cell for result instead of number.
    Could you help please what's wrong with my code?

    Thanks in advance.
    Hary.

  8. #8
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Copy process result from one file to another

    you will need to use
    COUNTIFS([FILE2.xls]Sheet1!R12C3,""TEXT1
    not =NB.SI([WSSub]Sheet!$C$12;"ESME to MS")

  9. #9
    Registered User
    Join Date
    03-23-2011
    Location
    Madagascar
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Copy process result from one file to another

    Quote Originally Posted by pike View Post
    you will need to use
    COUNTIFS([FILE2.xls]Sheet1!R12C3,""TEXT1
    not =NB.SI([WSSub]Sheet!$C$12;"ESME to MS")
    Hi,

    I got "execution error 1004" when I use:

    Please Login or Register  to view this content.
    I use above code instead of below code in order to simplify the problem
    Please Login or Register  to view this content.
    Just for your information, following code:
    Please Login or Register  to view this content.
    is the result of the process inside the cell of result and my MS Excel is French version, it's why I got =NB.SI

    I think the code:
    Please Login or Register  to view this content.
    is fine but why I can't get the necessary value

    Regards.
    Hary.

  10. #10
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Copy process result from one file to another

    Why didn't you analyse the code I suggested and why didn't you adapt it to your needs ?

    Please Login or Register  to view this content.

  11. #11
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Copy process result from one file to another

    @snb,
    Why didn't you analyse the code I suggested and why didn't you adapt it to your needs ?
    Maybe you need to step back a bit. The OP clearly states in reply to your first code:

    Could you please explain me the action of this code as I'm new in macro?
    You didn't even bother to react to that. Imagine that there are people who don't know as much VBA as you do and find your coding style difficult to follow. Suggesting that they "analyse" your code and "adapt it to their needs" adds insult to injury.

  12. #12
    Registered User
    Join Date
    03-23-2011
    Location
    Madagascar
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Copy process result from one file to another

    Quote Originally Posted by snb View Post
    Why didn't you analyse the code I suggested and why didn't you adapt it to your needs ?

    Please Login or Register  to view this content.
    Meanwhile I dissect your code, I propose you to find here below the code I used currently for this object after many surfing on the net. It's working fine but may be you have a best way to write it instead of mine:

    Please Login or Register  to view this content.
    However, many thanks for all peoples who tried to help and to support me. My macro learning with Excel is progressing slowly.

    Hary.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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