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 )
Worksheet: 1-Sheet1 15July 2020
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
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 )
Worksheet: Sheet1 15 July 2020
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
** 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 )
Worksheet: Output 15July BasketOrder
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
( 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 )
Worksheet: Sheet1 15 July
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 0BUY MARKET NA CLI MIS DAY WC5758 NA 3NA 2 NSE EQ NA NA NA 0 0SELL MARKET NA CLI MIS DAY WC5758 NA 3NA 3 NSE EQ NA NA NA 0 0BUY MARKET NA CLI MIS DAY WC5758 NA 3NA 4 NSE EQ NA NA NA 0 0BUY MARKET NA CLI MIS DAY WC5758 NA 3NA




, but we do have an Output
, ( and an empty initial worksheet**) , so the question will be assumed to be:
Reply With Quote

Bookmarks