Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Copy row from one workbook to another workbook based on conditions in another Workbook

  1. #11
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,451
    Rep Power
    10
    Your final solution may work, but your macro is a lot of mixed up crap with a lot of rubbish in it...

    It is not possible to do simple changes to a macro designed to work properly on text files to work instead on Excel files.

    But it is impossible to try to explain any of that to you.
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    _...KILL A MODERATOR!!

  2. #12
    Senior Member
    Join Date
    Jul 2019
    Posts
    382
    Rep Power
    0
    Doc Sir I have uploaded the sample file with output & i have also provided the condition also for this problem Sir

  3. #13
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,451
    Rep Power
    10
    This forum is for the benefit of people seeking help in Excel and Excel VBA.
    So, when I have time , I may complete this thread by answering the initial question.
    I will base the answer on the files and the problem description.
    The rest of your dribble in the post is based on some history that you are either purposely trying to hide from us or your incompetence on knowing anything about where the original macro or original files are suggests that you should give up with anything to do with computing as you don’t have a chance in hell of ever organising or getting any final working system operational.




    I have banned you again, temporarily, to give us a break from you.

    You seem to have recently discovered excelforum, ( and most likely a few other places you are keeping secret from us), as a good place, or places, to hide multiple accounts and duplicated cross postings, so I guess you will have no problem continuing your strategy of positing duplicated poorly explained similar postings , seemingly hoping that someone will magically supply a macro or macros that solve some problem that you don’t seem yourself to have any clue about most of the time..
    ( Possibly someone else is driving you, ( or something in your brain is driving you that probably needs surgery to remove…) )
    Last edited by DocAElstein; 07-22-2020 at 12:42 PM.
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    _...KILL A MODERATOR!!

  4. #14
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,451
    Rep Power
    10
    Solution ( attempt )
    This solution is based solely on the files from Post#1 and an attempt at the correct question below. Everything else form this post, and at the cross post, is ignored since the OP either
    has no idea about
    or is unwilling to give any information about the given macros
    and statements like “it works perfectly” or macro correction are invalid , unjustified, and are basically a lot of crap.



    The question is badly written , but we do have an Output , ( and an empty initial worksheet**) , so the question will be assumed to be:
    The data rows of 1.xls are considered, in particular the values in columns H and D
    _____ Workbook: 1.xls ( Using Excel 2007 32 bit )
    Row\Col D E F G H
    1 Open High Low Prev Close LTP
    2 2394.65 2417.35 2350 2394.65 2351.9
    3 156.75 161 150.05 156.8 159
    4 4113 4127.95 4037 4112.5 4058
    5 17090.05 17250 16700 17090.05 16700
    Worksheet: 1-Sheet1 15July 2020

    If column H of 1.xls is greater than column D of 1.xls then copy third row of orderformat.xlsx & paste it to basketorder.xlsx
    Else If column H of 1.xls is smaller than column D of 1.xls then copy first row of orderformat.xlsx & paste it to basketorder.xlsx


    _____ Workbook: OrderFormat.xlsx ( Using Excel 2007 32 bit )
    Row\Col A B C D E F G H I J K L M N O P Q R S T U
    1 NSE EQ NA NA NA 0 0 BUY MARKET NA CLI MIS DAY WC5758 NA 3 NA
    2 NSE EQ NA NA NA 0 0 SELL SL-M CLI MIS DAY WC5758 NA NA NA
    3 NSE EQ NA NA NA 0 0 SELL MARKET NA CLI MIS DAY WC5758 NA 3 NA
    4 NSE EQ NA NA NA 0 0 BUY SL-M CLI MIS DAY WC5758 NA NA NA
    Worksheet: Sheet1 15 July 2020

    ** I will assume the worksheet in BasketOrder.xlsx is empty initially.
    All worksheets are assumed to be the first tab worksheet ( Worksheets.Item(1) )
    Here is the given After Output:

    _____ Workbook: BasketOrder.xlsx ( Using Excel 2007 32 bit )
    Row\Col A B C D E F G H I J K L M N O P Q R S T U
    1 NSE EQ NA NA NA 0 0 SELL MARKET NA CLI MIS DAY WC5758 NA 3 NA
    2 NSE EQ NA NA NA 0 0 BUY MARKET NA CLI MIS DAY WC5758 NA 3 NA
    3 NSE EQ NA NA NA 0 0 SELL MARKET NA CLI MIS DAY WC5758 NA 3 NA
    4 NSE EQ NA NA NA 0 0 SELL MARKET NA CLI MIS DAY WC5758 NA 3 NA
    Worksheet: Output 15July BasketOrder

    ( Looking at the results, we see that the OP has got his logic and the Output after results the wrong way around. But that is typical. He is probably Autistic, or has some other brain defect: He often cannot distinguish between greater or smaller. All attempts to explain it to him fail ( https://excelfox.com/forum/showthrea...ll=1#post12848 ) )




    I have done a macro solution to satisfy the OP’s original given logic, https://excelfox.com/forum/showthrea...ll=1#post14718
    The basic code description is: We loop down the rows of 1.xls, checking if the column H value is greater or smaller than the column D value. Depending on the result we add a 1 or 3 to an array of indicia that we use in an array type Index calculation to give us the entire required output range in one go.
    The macro that satisfies the logic given by the OP, ( https://excelfox.com/forum/showthrea...ll=1#post14718 ) gives these results:


    _____ Workbook: BasketOrder.xlsx ( Using Excel 2007 32 bit )
    Row\Col A B C D E F G H I J K L M N O P Q R S T U
    1 NSE EQ NA NA NA
    0
    0
    BUY MARKET NA CLI MIS DAY WC5758 NA
    3
    NA
    2 NSE EQ NA NA NA
    0
    0
    SELL MARKET NA CLI MIS DAY WC5758 NA
    3
    NA
    3 NSE EQ NA NA NA
    0
    0
    BUY MARKET NA CLI MIS DAY WC5758 NA
    3
    NA
    4 NSE EQ NA NA NA
    0
    0
    BUY MARKET NA CLI MIS DAY WC5758 NA
    3
    NA
    Worksheet: Sheet1 15 July
    Last edited by DocAElstein; 07-26-2020 at 01:36 PM.
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    _...KILL A MODERATOR!!

  5. #15
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,451
    Rep Power
    10
    Avinash,
    As often, you had a very, very simple problem. The solution was very simple. You also probably had a very good solution, one particularly suited to efficiently solving your problem
    As often you have managed to totally mess up everything and make the issues 100 times more difficult for anyone to help you with.
    Because
    Your explanations are usually bad and incomplete.
    You post mostly rubbish and nonsense in your replies that confuse the issue further.
    You are on yet another useless time wasting strategy of taking well written macros that may or may not have any relevance to the issue at hand ( since you either know nothing about them or withhold information about them ), then you post them with the title “Macro correction”. Your new strategy just increases further your best talent: Making every issue 100 times more difficult for everyone and getting in a total chaotic mess.

    Bro, you are a fucking disaster. The way you are going, you will have no hope in hell of achieving anything other than failure in all that you do, unless your aim is to waste people’s time and annoy them. This you are very good in, better than any question askers that I have ever seen.

    Alan

    Edit…
    It never stops… Some people make mistakes sometimes. Avinash mostly makes mistakes, and mostly does not even realise, or due to some brain defect, Autism, or just total idiocy, can’t even see the obvious, even when told a 100 times…
    Quote Originally Posted by fixer View Post
    ……Condition:If column H of 1.xls is greater than column D of 1.xls then copy third row ……But i am 100% aware of my logic, my logic is always correct ….. My logic in this problem is (If column H is lower than column D then copy the third row, why we copied the third row bcoz….
    Last edited by DocAElstein; 07-27-2020 at 11:42 AM.
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    _...KILL A MODERATOR!!

Similar Threads

  1. Replies: 2
    Last Post: 07-07-2020, 05:42 PM
  2. Replies: 101
    Last Post: 06-11-2020, 02:01 PM
  3. Replies: 4
    Last Post: 04-10-2014, 10:58 PM
  4. Replies: 2
    Last Post: 09-18-2013, 12:30 AM
  5. Replies: 2
    Last Post: 05-28-2013, 05:32 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •