Welcome to the Excel Forum

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.

Please Register to Remove these Ads

Please Register to Remove these Ads



Reply
  #1  
Old 07-04-2009, 03:33 PM
antrix antrix is offline
Registered User
 
Join Date: 04 Jul 2009
Location: Houston
MS Office Version:Excel 2003
Posts: 2
antrix is becoming part of the community
Return Rows whose cell satisy a condition from other Work Sheet

Please Register to Remove these Ads

Guys,
I need help in resolving this.

I have a work sheet which is as follows:

Name Location Value
ABCD abcd1234 0
DEFG abdc1243 1
GHIJ abcd1324 1

In another Worksheet, I just want to display the rows which have the value cell to be "1" alone.
No human intervention of filtering needs to be done in teh whole process.

Would appreciate any suggestions either in a Formula or any other means

ANTRIX

Last edited by antrix; 07-04-2009 at 03:37 PM.
Reply With Quote
  #2  
Old 07-04-2009, 04:27 PM
stanleydgromjr stanleydgromjr is offline
Valued Forum Contributor
 
Join Date: 10 Oct 2008
Location: Northeast Pennsylvania, USA
MS Office Version:Excel 2003, 2007.
Posts: 695
stanleydgromjr has an addiction to Excel
Re: Return Rows whose cell satisy a condition from other Work Sheet

antrix,

Welcome to the Excel Forum.

I am assuming that "Name" is in cell A1, in Sheet1, and we are copying to Sheet2 (with the same titles in row 1).


Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

Adding the Macro
1. Copy the below macro, by highlighting the macro code and pressing the keys CTRL+C
2. Open your workbook
3. Press the keys ALT+F11 to open the Visual Basic Editor
4. Press the keys ALT+I to activate the Insert menu
5. Press M to insert a Standard Module
6. Paste the code by pressing the keys CTRL+V
7. Press the keys ALT+Q to exit the Editor, and return to Excel.

Code:
Option Explicit
Sub FindMatches()
Dim c As Range, firstaddress As String
Application.ScreenUpdating = False
With Sheets("Sheet1")
  With .Columns(3)
    Set c = .Find(1, LookIn:=xlValues, LookAt:=xlWhole)
    If Not c Is Nothing Then
      firstaddress = c.Address
      Do
        c.EntireRow.Copy Destination:=Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1)
        Set c = .FindNext(c)
      Loop While Not c Is Nothing And c.Address <> firstaddress
    End If
  End With
End With
Application.ScreenUpdating = True
End Sub

Then run the "FindMatches" macro.
__________________
Have a great day,
Stan

stanleydgromjr
Windows Vista Business, Excel 2003 and 2007
Reply With Quote
  #3  
Old 07-08-2009, 03:26 PM
antrix antrix is offline
Registered User
 
Join Date: 04 Jul 2009
Location: Houston
MS Office Version:Excel 2003
Posts: 2
antrix is becoming part of the community
Re: Return Rows whose cell satisy a condition from other Work Sheet

Thank you very much buddy
It hepled me.
Regards
Antrix
Reply With Quote


Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump