Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Match several values in €˜Summary Sheet to several values in €˜Mast

I found the Code below, on a post at this very DG, a while back:
Sub stance()
Dim myrange, copyrange As Range
Sheets("Mapping AM").Select
Set myrange = Range("E2:E200")
For Each c In myrange
If c.Value < "" Then
If copyrange Is Nothing Then
Set copyrange = c.EntireRow
Else
Set copyrange = Union(copyrange, c.EntireRow)
End If

End If
Next
copyrange.Copy
Sheets("Summary Sheet").Select 'Change to suit
Cells(1, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues
End Sub

I will put an €˜x in Column E of sheet €˜Mapping AM and run the code.

This gets me close to where I would like to be. The next step, and I think
final step€¦I hope€¦is to take the values in the €˜Summary Sheet, in Column B,
and find matches in another sheet, named €˜Master, and somehow tie the items
in €˜Summary Sheet to the items in €˜Master. I guess, some kind of cascade
would make sense. Im kind of stuck on how to display the final results, so
I am open to suggestions, and definitely open to help about how to match
values in €˜Summary Sheet to €˜Master. I guess Index/Match may work.
Perhaps filter the column, if the values on the two sheets match. Something
along those lines should get me pretty close to being done with this project.
Finally, I would like to copy the entire row in €˜Master if the items in
€˜Master match the items in €˜Summary Sheet.

The thing that makes this difficult is that there may be one value, like
€˜Lee and several salespeople report to €˜Lee. I want to copy/paste these
salespeople into a hierarchy-type table, maybe inserting a variable number of
rows, to show the relationships between €˜Lee and his sales staff. Vlookup
wont do what I need to do.

Thanks,
Ryan---





--
RyGuy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Match several values in €˜Summary Sheet to several values in €˜Mast

This doesn't answer your question, but I just read something today about this

Dim myrange, copyrange As Range

translates to
Dim myrange as Variant
Dim copyrange As Range

Is that really what you want?
--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"ryguy7272" wrote:

I found the Code below, on a post at this very DG, a while back:
Sub stance()
Dim myrange, copyrange As Range
Sheets("Mapping AM").Select
Set myrange = Range("E2:E200")
For Each c In myrange
If c.Value < "" Then
If copyrange Is Nothing Then
Set copyrange = c.EntireRow
Else
Set copyrange = Union(copyrange, c.EntireRow)
End If

End If
Next
copyrange.Copy
Sheets("Summary Sheet").Select 'Change to suit
Cells(1, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues
End Sub

I will put an €˜x in Column E of sheet €˜Mapping AM and run the code.

This gets me close to where I would like to be. The next step, and I think
final step€¦I hope€¦is to take the values in the €˜Summary Sheet, in Column B,
and find matches in another sheet, named €˜Master, and somehow tie the items
in €˜Summary Sheet to the items in €˜Master. I guess, some kind of cascade
would make sense. Im kind of stuck on how to display the final results, so
I am open to suggestions, and definitely open to help about how to match
values in €˜Summary Sheet to €˜Master. I guess Index/Match may work.
Perhaps filter the column, if the values on the two sheets match. Something
along those lines should get me pretty close to being done with this project.
Finally, I would like to copy the entire row in €˜Master if the items in
€˜Master match the items in €˜Summary Sheet.

The thing that makes this difficult is that there may be one value, like
€˜Lee and several salespeople report to €˜Lee. I want to copy/paste these
salespeople into a hierarchy-type table, maybe inserting a variable number of
rows, to show the relationships between €˜Lee and his sales staff. Vlookup
wont do what I need to do.

Thanks,
Ryan---





--
RyGuy

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Match several values in €˜Summary Sheet to several values in €˜

Hi B arb, You are correct. To be efficient the Dim should always specify
the As for each variable in VBA although some scripters get in the habit of
not using As since all Script variables are vaiant data types. However, in
this case he later uses the Set statement which pretty well ties it down as
an Object variable.

"Barb Reinhardt" wrote:

This doesn't answer your question, but I just read something today about this

Dim myrange, copyrange As Range

translates to
Dim myrange as Variant
Dim copyrange As Range

Is that really what you want?
--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



"ryguy7272" wrote:

I found the Code below, on a post at this very DG, a while back:
Sub stance()
Dim myrange, copyrange As Range
Sheets("Mapping AM").Select
Set myrange = Range("E2:E200")
For Each c In myrange
If c.Value < "" Then
If copyrange Is Nothing Then
Set copyrange = c.EntireRow
Else
Set copyrange = Union(copyrange, c.EntireRow)
End If

End If
Next
copyrange.Copy
Sheets("Summary Sheet").Select 'Change to suit
Cells(1, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues
End Sub

I will put an €˜x in Column E of sheet €˜Mapping AM and run the code.

This gets me close to where I would like to be. The next step, and I think
final step€¦I hope€¦is to take the values in the €˜Summary Sheet, in Column B,
and find matches in another sheet, named €˜Master, and somehow tie the items
in €˜Summary Sheet to the items in €˜Master. I guess, some kind of cascade
would make sense. Im kind of stuck on how to display the final results, so
I am open to suggestions, and definitely open to help about how to match
values in €˜Summary Sheet to €˜Master. I guess Index/Match may work.
Perhaps filter the column, if the values on the two sheets match. Something
along those lines should get me pretty close to being done with this project.
Finally, I would like to copy the entire row in €˜Master if the items in
€˜Master match the items in €˜Summary Sheet.

The thing that makes this difficult is that there may be one value, like
€˜Lee and several salespeople report to €˜Lee. I want to copy/paste these
salespeople into a hierarchy-type table, maybe inserting a variable number of
rows, to show the relationships between €˜Lee and his sales staff. Vlookup
wont do what I need to do.

Thanks,
Ryan---





--
RyGuy

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Match several values in €˜Summary Sheet to several values in €˜Mast

Database design is 95% of any sizable project. If you look at some of the
tutorials for Pivot tables, you will see how a well laid out database lends
itself to not only data manipulation, but also logical grouping of data
source, etc. Code writing is simplified when the writer does not have to use
exotic code to accomplish their goal. In summary, organizing your data
properly makes it a lot easier.

"ryguy7272" wrote:

I found the Code below, on a post at this very DG, a while back:
Sub stance()
Dim myrange, copyrange As Range
Sheets("Mapping AM").Select
Set myrange = Range("E2:E200")
For Each c In myrange
If c.Value < "" Then
If copyrange Is Nothing Then
Set copyrange = c.EntireRow
Else
Set copyrange = Union(copyrange, c.EntireRow)
End If

End If
Next
copyrange.Copy
Sheets("Summary Sheet").Select 'Change to suit
Cells(1, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues
End Sub

I will put an €˜x in Column E of sheet €˜Mapping AM and run the code.

This gets me close to where I would like to be. The next step, and I think
final step€¦I hope€¦is to take the values in the €˜Summary Sheet, in Column B,
and find matches in another sheet, named €˜Master, and somehow tie the items
in €˜Summary Sheet to the items in €˜Master. I guess, some kind of cascade
would make sense. Im kind of stuck on how to display the final results, so
I am open to suggestions, and definitely open to help about how to match
values in €˜Summary Sheet to €˜Master. I guess Index/Match may work.
Perhaps filter the column, if the values on the two sheets match. Something
along those lines should get me pretty close to being done with this project.
Finally, I would like to copy the entire row in €˜Master if the items in
€˜Master match the items in €˜Summary Sheet.

The thing that makes this difficult is that there may be one value, like
€˜Lee and several salespeople report to €˜Lee. I want to copy/paste these
salespeople into a hierarchy-type table, maybe inserting a variable number of
rows, to show the relationships between €˜Lee and his sales staff. Vlookup
wont do what I need to do.

Thanks,
Ryan---





--
RyGuy

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Match several values in €˜Summary Sheet to several values in €˜

You were right, JLGWhiz! When I sat down and REALLY thought about my needs
for this project, I was able to rework some things and eventually come up
with a solution. Everything is working now!! Thanks for the push!!

Regards,
Ryan---


--
RyGuy


"JLGWhiz" wrote:

Database design is 95% of any sizable project. If you look at some of the
tutorials for Pivot tables, you will see how a well laid out database lends
itself to not only data manipulation, but also logical grouping of data
source, etc. Code writing is simplified when the writer does not have to use
exotic code to accomplish their goal. In summary, organizing your data
properly makes it a lot easier.

"ryguy7272" wrote:

I found the Code below, on a post at this very DG, a while back:
Sub stance()
Dim myrange, copyrange As Range
Sheets("Mapping AM").Select
Set myrange = Range("E2:E200")
For Each c In myrange
If c.Value < "" Then
If copyrange Is Nothing Then
Set copyrange = c.EntireRow
Else
Set copyrange = Union(copyrange, c.EntireRow)
End If

End If
Next
copyrange.Copy
Sheets("Summary Sheet").Select 'Change to suit
Cells(1, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues
End Sub

I will put an €˜x in Column E of sheet €˜Mapping AM and run the code.

This gets me close to where I would like to be. The next step, and I think
final step€¦I hope€¦is to take the values in the €˜Summary Sheet, in Column B,
and find matches in another sheet, named €˜Master, and somehow tie the items
in €˜Summary Sheet to the items in €˜Master. I guess, some kind of cascade
would make sense. Im kind of stuck on how to display the final results, so
I am open to suggestions, and definitely open to help about how to match
values in €˜Summary Sheet to €˜Master. I guess Index/Match may work.
Perhaps filter the column, if the values on the two sheets match. Something
along those lines should get me pretty close to being done with this project.
Finally, I would like to copy the entire row in €˜Master if the items in
€˜Master match the items in €˜Summary Sheet.

The thing that makes this difficult is that there may be one value, like
€˜Lee and several salespeople report to €˜Lee. I want to copy/paste these
salespeople into a hierarchy-type table, maybe inserting a variable number of
rows, to show the relationships between €˜Lee and his sales staff. Vlookup
wont do what I need to do.

Thanks,
Ryan---





--
RyGuy

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
Match Values in Rows with Partial Values in Columns ryguy7272 Excel Worksheet Functions 3 August 8th 07 05:14 PM
How do I match values in one spreadsheet to values in another? David Excel Worksheet Functions 2 August 15th 06 03:30 PM
How to match values in one column to values in another? trib Excel Worksheet Functions 3 July 25th 06 08:30 AM
subtotalling with summary values above Leslie Miller Excel Discussion (Misc queries) 1 December 15th 04 08:53 PM
How do i compare values from two sheet and copy & paste if values match? rozb Excel Programming 0 March 5th 04 12:06 AM


All times are GMT +1. The time now is 04:02 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"