Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,069
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,069
Default 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


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default 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


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,069
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I creat a macro to delete the first 20 cell characters Bobo-ack Excel Worksheet Functions 5 April 20th 07 03:00 AM
creat a macro to save a copy with different file name yrndtn Excel Discussion (Misc queries) 2 September 8th 06 01:14 PM
Creat dsanita Excel Discussion (Misc queries) 0 July 25th 06 10:01 PM
How can I creat NYExcel Excel Discussion (Misc queries) 2 April 17th 06 04:39 PM
creat a macro to look for a file Kelly****** Excel Discussion (Misc queries) 1 January 2nd 05 09:24 AM


All times are GMT +1. The time now is 05:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"