Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ty Ty is offline
external usenet poster
 
Posts: 72
Default Matching Rows 2nd try

This is part of the long thread with the subject Vlookup & Copy. I
finally have an idea on what is needed to solve this problem after
stepping through the code.

1. I need this section to output the results on another
Sheet=Sheet3.
2. ID & Employee should be swapped. Each Employee has a number of
ID's.
3. Is it possible to do another match for the Col C:sheet1 to the
results/output of Col A? If there is a match copy all of that ROW
from Col C:Col O on the same row as that matching Employee.
4. Is it possible to do #3 the same time as the Matching is being
done to Sheet2?

Sub MatchingRows()
'
' NOTE: The macro assumes there is a header in the both worksheets
' The macro starts at row 2 and sort data automatically
'
ScreenUpdating = False


'get first empty row of sheet1
With Sheets("Sheet1")
LastRow = .Range("A" & Rows.Count).End(xlUp).Row
NewRow = LastRow + 1
End With


'find matching rows in sheet 2
With Sheets("Sheet2")
RowCount = 2
Do While .Range("A" & RowCount) < ""
ID = Trim(.Range("A" & RowCount))
Employee = Trim(.Range("B" & RowCount))
'compare - look for ID in Sheet 1
With Sheets("Sheet1")
Set c = .Columns("A").Find(what:=ID, _
LookIn:=xlValues, lookat:=xlWhole, MatchCase:=False)
If Not c Is Nothing Then
'add to end of sheet 1
.Range("A" & NewRow) = ID
.Range("B" & NewRow) = Employee
NewRow = NewRow + 1
End If
End With


RowCount = RowCount + 1
Loop
End With

Thanks for your help...
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Matching Rows 2nd try

If desired, send your file to my address below along with this msg and
a clear explanation of what you want and before/after examples.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Ty" wrote in message
...
This is part of the long thread with the subject Vlookup & Copy. I
finally have an idea on what is needed to solve this problem after
stepping through the code.

1. I need this section to output the results on another
Sheet=Sheet3.
2. ID & Employee should be swapped. Each Employee has a number of
ID's.
3. Is it possible to do another match for the Col C:sheet1 to the
results/output of Col A? If there is a match copy all of that ROW
from Col C:Col O on the same row as that matching Employee.
4. Is it possible to do #3 the same time as the Matching is being
done to Sheet2?

Sub MatchingRows()
'
' NOTE: The macro assumes there is a header in the both worksheets
' The macro starts at row 2 and sort data automatically
'
ScreenUpdating = False


'get first empty row of sheet1
With Sheets("Sheet1")
LastRow = .Range("A" & Rows.Count).End(xlUp).Row
NewRow = LastRow + 1
End With


'find matching rows in sheet 2
With Sheets("Sheet2")
RowCount = 2
Do While .Range("A" & RowCount) < ""
ID = Trim(.Range("A" & RowCount))
Employee = Trim(.Range("B" & RowCount))
'compare - look for ID in Sheet 1
With Sheets("Sheet1")
Set c = .Columns("A").Find(what:=ID, _
LookIn:=xlValues, lookat:=xlWhole, MatchCase:=False)
If Not c Is Nothing Then
'add to end of sheet 1
.Range("A" & NewRow) = ID
.Range("B" & NewRow) = Employee
NewRow = NewRow + 1
End If
End With


RowCount = RowCount + 1
Loop
End With

Thanks for your help...


  #3   Report Post  
Posted to microsoft.public.excel.programming
Ty Ty is offline
external usenet poster
 
Posts: 72
Default Matching Rows 2nd try

On Aug 13, 5:11*pm, "Don Guillett" wrote:
* * * If desired, send your file to my address below along with this msg and
a clear explanation of what you want and before/after examples.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"Ty" wrote in message

...



This is part of the long thread with the subject Vlookup & Copy. *I
finally have an idea on what is needed to solve this problem after
stepping through the code.


1. *I need this section to output the results on another
Sheet=Sheet3.
2. *ID & Employee should be swapped. *Each Employee has a number of
ID's.
3. *Is it possible to do another match for the Col C:sheet1 to the
results/output of Col A? *If there is a match copy all of that ROW
from Col C:Col O on the same row as that matching Employee.
4. *Is it possible to do #3 the same time as the Matching is being
done to Sheet2?


Sub MatchingRows()
* '
* ' NOTE: The macro assumes there is a header in the both worksheets
* ' * * * The macro starts at row 2 and sort data automatically
* '
* ScreenUpdating = False


* 'get first empty row of sheet1
* With Sheets("Sheet1")
* * *LastRow = .Range("A" & Rows.Count).End(xlUp).Row
* * *NewRow = LastRow + 1
* End With


* 'find matching rows in sheet 2
* With Sheets("Sheet2")
* * *RowCount = 2
* * *Do While .Range("A" & RowCount) < ""
* * * * ID = Trim(.Range("A" & RowCount))
* * * * Employee = Trim(.Range("B" & RowCount))
* * * * 'compare - look for ID in Sheet 1
* * * * With Sheets("Sheet1")
* * * * * *Set c = .Columns("A").Find(what:=ID, _
* * * * * * * LookIn:=xlValues, lookat:=xlWhole, MatchCase:=False)
* * * * * *If Not c Is Nothing Then
* * * * * * * 'add to end of sheet 1
* * * * * * * .Range("A" & NewRow) = ID
* * * * * * * .Range("B" & NewRow) = Employee
* * * * * * * NewRow = NewRow + 1
* * * * * *End If
* * * * End With


* * * * RowCount = RowCount + 1
* * *Loop
* End With


Thanks for your help...- Hide quoted text -


- Show quoted text -


Thanks for your response. I will send over examples and pictures.
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
Matching Rows Blissfully Ignorant Excel Discussion (Misc queries) 2 July 25th 08 09:33 PM
Matching rows in 2 sheets and copying matching rows from sheet 1 t fbagirov Excel Programming 1 April 8th 07 03:44 PM
Sum rows above me matching critiera... Gary F Excel Programming 3 September 18th 06 04:42 PM
Sum Rows with a matching date teeb Excel Discussion (Misc queries) 4 April 18th 06 12:49 PM
select only non-matching rows fuzzy Excel Programming 1 August 23rd 05 03:50 PM


All times are GMT +1. The time now is 09:22 PM.

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

About Us

"It's about Microsoft Excel"