![]() |
Pls help for creat a Macro....
sample:
location number product 4 100600 A 4 100600 A 5 103200 A 6 103500 A 6 103500 A 11 106600 B 15 106600 A 18 119200 A 20 119200 B 8 103200 A 9 103800 A 19 105000 B 13 105000 B what I need is: lookup at columns A and B, if number is same and location is same then do nothing. if the number is same and the location is different, then copy that row range like (A7-C7 and A8-C8) to G7 and G8. check sample below: location number product 4 100600 A 4 100600 A 5 103200 A 6 103500 A 6 103500 A 11 106600 B 11 106600 B 15 106600 A 15 106600 A 18 119200 A 18 119200 A 20 119200 B 20 119200 B 8 103200 A 9 103800 A 19 105000 B 19 105000 B 13 105000 B 13 105000 B |
Pls help for creat a Macro....
It is not clear which columns you are comparing. The results will go in
column G & H? Which is the second set of columns that are being compared? "John" wrote: sample: location number product 4 100600 A 4 100600 A 5 103200 A 6 103500 A 6 103500 A 11 106600 B 15 106600 A 18 119200 A 20 119200 B 8 103200 A 9 103800 A 19 105000 B 13 105000 B what I need is: lookup at columns A and B, if number is same and location is same then do nothing. if the number is same and the location is different, then copy that row range like (A7-C7 and A8-C8) to G7 and G8. check sample below: location number product 4 100600 A 4 100600 A 5 103200 A 6 103500 A 6 103500 A 11 106600 B 11 106600 B 15 106600 A 15 106600 A 18 119200 A 18 119200 A 20 119200 B 20 119200 B 8 103200 A 9 103800 A 19 105000 B 19 105000 B 13 105000 B 13 105000 B |
Pls help for creat a Macro....
if you look at the sample, in columns A and B(4 100600)is same as 2sd row
then do nothing. I only want to coping out to column G, like in rows 6&7 (11 106600 & 15 106600) the number is same but the location is different. that is what I want to copy out, is that clear. see this sample: A B C G H I ------------------------------------------------------------------------------------ 4 100600 A row 1 4 100600 A row 2 5 103200 A row 3 6 103500 A row 4 6 103500 A row 5 11 106600 B row 6 11 106600 B 15 106600 A row 7 15 106600 A 18 119200 A row 8 18 119200 A 20 119200 B row 9 20 119200 B 8 103200 A row 10 9 103800 A row 11 19 105000 B row 12 19 105000 B 13 105000 B row 13 13 105000 B "Joel" wrote: It is not clear which columns you are comparing. The results will go in column G & H? Which is the second set of columns that are being compared? "John" wrote: sample: location number product 4 100600 A 4 100600 A 5 103200 A 6 103500 A 6 103500 A 11 106600 B 15 106600 A 18 119200 A 20 119200 B 8 103200 A 9 103800 A 19 105000 B 13 105000 B what I need is: lookup at columns A and B, if number is same and location is same then do nothing. if the number is same and the location is different, then copy that row range like (A7-C7 and A8-C8) to G7 and G8. check sample below: location number product 4 100600 A 4 100600 A 5 103200 A 6 103500 A 6 103500 A 11 106600 B 11 106600 B 15 106600 A 15 106600 A 18 119200 A 18 119200 A 20 119200 B 20 119200 B 8 103200 A 9 103800 A 19 105000 B 19 105000 B 13 105000 B 13 105000 B |
Pls help for creat a Macro....
Sub comparerows() RowCount = 1 Do While Range("A" & RowCount) < "" If Range("B" & RowCount) = _ Range("B" & (RowCount + 1)) And _ Range("A" & RowCount) < _ Range("A" & (RowCount + 1)) Then Range("A" & RowCount & ":C" & RowCount).Copy _ Destination:=Range("G" & RowCount) Range("A" & (RowCount + 1) & ":C" & (RowCount + 1)).Copy _ Destination:=Range("G" & (RowCount + 1)) End If RowCount = RowCount + 1 Loop End Sub "John" wrote: if you look at the sample, in columns A and B(4 100600)is same as 2sd row then do nothing. I only want to coping out to column G, like in rows 6&7 (11 106600 & 15 106600) the number is same but the location is different. that is what I want to copy out, is that clear. see this sample: A B C G H I ------------------------------------------------------------------------------------ 4 100600 A row 1 4 100600 A row 2 5 103200 A row 3 6 103500 A row 4 6 103500 A row 5 11 106600 B row 6 11 106600 B 15 106600 A row 7 15 106600 A 18 119200 A row 8 18 119200 A 20 119200 B row 9 20 119200 B 8 103200 A row 10 9 103800 A row 11 19 105000 B row 12 19 105000 B 13 105000 B row 13 13 105000 B "Joel" wrote: It is not clear which columns you are comparing. The results will go in column G & H? Which is the second set of columns that are being compared? "John" wrote: sample: location number product 4 100600 A 4 100600 A 5 103200 A 6 103500 A 6 103500 A 11 106600 B 15 106600 A 18 119200 A 20 119200 B 8 103200 A 9 103800 A 19 105000 B 13 105000 B what I need is: lookup at columns A and B, if number is same and location is same then do nothing. if the number is same and the location is different, then copy that row range like (A7-C7 and A8-C8) to G7 and G8. check sample below: location number product 4 100600 A 4 100600 A 5 103200 A 6 103500 A 6 103500 A 11 106600 B 11 106600 B 15 106600 A 15 106600 A 18 119200 A 18 119200 A 20 119200 B 20 119200 B 8 103200 A 9 103800 A 19 105000 B 19 105000 B 13 105000 B 13 105000 B |
Pls help for creat a Macro....
Thank's alots Joel. your macro work very good. well done............yeh
"Joel" wrote: Sub comparerows() RowCount = 1 Do While Range("A" & RowCount) < "" If Range("B" & RowCount) = _ Range("B" & (RowCount + 1)) And _ Range("A" & RowCount) < _ Range("A" & (RowCount + 1)) Then Range("A" & RowCount & ":C" & RowCount).Copy _ Destination:=Range("G" & RowCount) Range("A" & (RowCount + 1) & ":C" & (RowCount + 1)).Copy _ Destination:=Range("G" & (RowCount + 1)) End If RowCount = RowCount + 1 Loop End Sub "John" wrote: if you look at the sample, in columns A and B(4 100600)is same as 2sd row then do nothing. I only want to coping out to column G, like in rows 6&7 (11 106600 & 15 106600) the number is same but the location is different. that is what I want to copy out, is that clear. see this sample: A B C G H I ------------------------------------------------------------------------------------ 4 100600 A row 1 4 100600 A row 2 5 103200 A row 3 6 103500 A row 4 6 103500 A row 5 11 106600 B row 6 11 106600 B 15 106600 A row 7 15 106600 A 18 119200 A row 8 18 119200 A 20 119200 B row 9 20 119200 B 8 103200 A row 10 9 103800 A row 11 19 105000 B row 12 19 105000 B 13 105000 B row 13 13 105000 B "Joel" wrote: It is not clear which columns you are comparing. The results will go in column G & H? Which is the second set of columns that are being compared? "John" wrote: sample: location number product 4 100600 A 4 100600 A 5 103200 A 6 103500 A 6 103500 A 11 106600 B 15 106600 A 18 119200 A 20 119200 B 8 103200 A 9 103800 A 19 105000 B 13 105000 B what I need is: lookup at columns A and B, if number is same and location is same then do nothing. if the number is same and the location is different, then copy that row range like (A7-C7 and A8-C8) to G7 and G8. check sample below: location number product 4 100600 A 4 100600 A 5 103200 A 6 103500 A 6 103500 A 11 106600 B 11 106600 B 15 106600 A 15 106600 A 18 119200 A 18 119200 A 20 119200 B 20 119200 B 8 103200 A 9 103800 A 19 105000 B 19 105000 B 13 105000 B 13 105000 B |
All times are GMT +1. The time now is 11:49 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com