+ Reply to Thread
Results 1 to 4 of 4

Excel 2007 : Create list on new worksheet based on cell value

Hybrid View

  1. #1
    Registered User
    Join Date
    01-03-2012
    Location
    Frederick, MD
    MS-Off Ver
    Excel 2007
    Posts
    4

    Create list on new worksheet based on cell value

    I am new to the forum and tried to find what i was looking for prior to posting but could only find posts that were similar but not quite what I needed. So here goes.

    I have a list of investors on my Master sheet, and I need to create a list based on the responses in Column B-E. I have attached an example sheet. I need the investor number to be included on a list on the appropriate sheet.

    ex:
    Investor HAM PRA UP HAFA
    00064 no yes no input no
    I need investor #00064 to go to 4 corresponding sheets, HAM NO, PRA YES, UP UNKNOWN, and HAFA NO.

    I do not want the investor number to be removed from the Master sheet.
    Attached Files Attached Files

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Create list on new worksheet based on cell value

    Just a couple of questions for u.
    1. The other tabs dont have any headers, so i believe that only the Investor number should be copied there right?
    2. Would this copying of data be done on a click of a button? So, after all the entries are done, you would click the button and the data would be transferred?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    01-03-2012
    Location
    Frederick, MD
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Create list on new worksheet based on cell value

    1. Yes only investor number should transfer
    2. I need it to be ongoing, so when a no is changed to a yes then the investor number is automatically moved from one list to another.

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Create list on new worksheet based on cell value

    Use this code -
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Column = 2 Then
        If Target.Value = "no" Then
            Cells(Target.Row, 1).Copy Worksheets("HAM NO").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
            On Error Resume Next
            Set rcell = Worksheets("HAM YES").Cells.Find(What:=Cells(Target.Row, 1).Value, After:=Range("A1"), LookIn:=xlValues, LookAt:= _
                xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
            rcell.Value = ""
            Set rcell = Worksheets("HAM UNKNOWN").Cells.Find(What:=Cells(Target.Row, 1).Value, After:=Range("A1"), LookIn:=xlValues, LookAt:= _
                xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
            rcell.Value = ""
        ElseIf Target.Value = "yes" Then
            Cells(Target.Row, 1).Copy Worksheets("HAM YES").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
            On Error Resume Next
            Set rcell = Worksheets("HAM NO").Cells.Find(What:=Cells(Target.Row, 1).Value, After:=Range("A1"), LookIn:=xlValues, LookAt:= _
                xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
            rcell.Value = ""
            Set rcell = Worksheets("HAM UNKNOWN").Cells.Find(What:=Cells(Target.Row, 1).Value, After:=Range("A1"), LookIn:=xlValues, LookAt:= _
                xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
            rcell.Value = ""
        ElseIf Target.Value = "" Then
            Cells(Target.Row, 1).Copy Worksheets("HAM UNKNOWN").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
            On Error Resume Next
            Set rcell = Worksheets("HAM YES").Cells.Find(What:=Cells(Target.Row, 1).Value, After:=Range("A1"), LookIn:=xlValues, LookAt:= _
                xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
            rcell.Value = ""
            Set rcell = Worksheets("HAM NO").Cells.Find(What:=Cells(Target.Row, 1).Value, After:=Range("A1"), LookIn:=xlValues, LookAt:= _
                xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)
            rcell.Value = ""
        End If
    ElseIf Target.Column = 3 Then
    'REpeat above code for PRA
    ElseIf Target.Column = 4 Then
    'REpeat above code for UP
    ElseIf Target.Column = 5 Then
    'Repeat above code for HAFA
    End If
    
    For i = 1 To Worksheets.Count
        If Worksheets(i) <> "Master" Then
            Columns("A:A").TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
                TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
                Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
                :=Array(1, 1), TrailingMinusNumbers:=True
            Columns("A:A").RemoveDuplicates Columns:=1, Header:=xlNo
        End If
    Next i
    
    End Sub
    I have completed the code for HAM YES, NO & UNKNOWN. Just copy the same code for PRA, UP & HAFA and change the sheet names. Do let me know if you need help with it.

    You need to right click on Master tab, click view code and copy the above code there.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1