PC Review


Reply
Thread Tools Rate Thread

2 lists - extract from one all matches, edit in a new list then re

 
 
=?Utf-8?B?Y29sb3JhZG84MDg=?=
Guest
Posts: n/a
 
      14th Jan 2007
How do I cut a set of data lines from a worksheet of data and put them into
another worksheet, based upon a match of one field to a combo box.

i.e. select a name in a combo box

go to the detailed data worksheet

find all lines that match that name in a particular field

cut those lines from the detailed worksheet and put them in another worksheet.

The data worksheet will continually be changing in size...

Any suggestions?
 
Reply With Quote
 
 
 
 
=?Utf-8?B?SkxHV2hpeg==?=
Guest
Posts: n/a
 
      15th Jan 2007
I have to be honest and tell you that I don't work very much with comboboxes,
but this seemed to work OK when I tested it. Try it on a copy of your sheet
in a new wb first.

Sub cpyPstCmbo()

Dim ws1 As Worksheet, ws2 As Worksheet, cb As Variant
Set ws1 = Worksheets(1)
Set ws2 = Worksheets(2)
UserForm1.Show
Set cb = UserForm1.ComboBox1

lr = Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To lr
If Cells(i, 1) = cb.Value Then
Cells(i, 1).EntireRow.Copy
ws2.Activate
If Cells(1, 1) <> "" Then
ws2.Cells(Cells(Rows.Count, 1).End(xlUp).Row + 1, 1).Activate
Else
ws2.Cells(1, 1).Activate
End If
ActiveSheet.Paste
ws1.Activate
End If
Next
Application.CutCopyMode = False
End Sub


"colorado808" wrote:

> How do I cut a set of data lines from a worksheet of data and put them into
> another worksheet, based upon a match of one field to a combo box.
>
> i.e. select a name in a combo box
>
> go to the detailed data worksheet
>
> find all lines that match that name in a particular field
>
> cut those lines from the detailed worksheet and put them in another worksheet.
>
> The data worksheet will continually be changing in size...
>
> Any suggestions?

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compare two lists for matches =?Utf-8?B?V2hpdG5leQ==?= Microsoft Excel Programming 3 24th Oct 2007 08:04 PM
Comparing two lists for matches - with a twist! Vidita Microsoft Excel Discussion 1 26th Jul 2007 11:53 AM
Loop through the columns and extract the matches ebraun01 Microsoft Excel Programming 14 17th Feb 2006 10:26 PM
An Algorithm that matches two lists DDONNI Microsoft Excel Programming 0 25th Oct 2004 02:25 PM
An Algorithm that matches two lists DDONNI Microsoft Excel Programming 1 19th Oct 2004 12:16 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:42 PM.