Results 1 to 1 of 1

Display data by clicking the link.

Threaded View

  1. #1
    Registered User
    Join Date
    05-16-2012
    Location
    malaysia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Display data by clicking the link.

    Hi everyone..

    How to list relevent data when we click into the specific link? Please refer attachment for more understanding.Actually, this coding is already successfully run but it only display the latest data and not all data. Below are my coding.


    Sheets("Database").Unprotect Password:=""
    
    With Sheets("MasterList")
    
    .Unprotect Password:=""
    .Boxa = Target.TextToDisplay
    .Visible = True
       
    Dim sht1 As Worksheet
    Dim FindString As String, FirstAddress As String
    Dim Rng As Range
        
        Set sht1 = Sheets("MasterList")
         
        Application.ScreenUpdating = False
         
        Sheets("MasterList").Range("A7:L165536").ClearContents
        
        sht1.Activate
        Set sht1 = Nothing
        
        MyArr = Array(Sheets("Database"))
        
        FindString = Target.TextToDisplay
                
        If Trim(FindString) <> "" Then
        
        With Sheets("Database").Range("A:L")
        
         For I = LBound(MyArr) To UBound(MyArr)
          
        Set Rng = .Find(What:=FindString, _
                     After:=.Cells(.Cells.count), _
                     LookIn:=xlValues, _
                     LookAt:=xlWhole, _
                     SearchOrder:=xlByRows, _
                     SearchDirection:=xlNext, _
                     MatchCase:=False)
                                              
        If Rng Is Nothing Then
        MsgBox "Data Not Found"
        Else
        FindString = Rng
        FirstAddress = Rng.Address
       
        Do
        Rng.EntireRow.Copy
        Sheets("MasterList").[A165536].End(xlUp)(7).PasteSpecial Paste:=xlValues
        Application.Selection.HorizontalAlignment = xlCenter
            Set Rng = .FindNext(Rng)
            Loop While Not Rng Is Nothing And Rng.Address <> FirstAddress
        End If
        Next I
        End With
        
          Application.ScreenUpdating = True
            
    End If
    
    End With
        
    Sheets("MasterList").Protect Password:=""
    Sheets("Database").Protect Password:=""
    
    End Sub
    Attached Files Attached Files
    Last edited by Paul; 05-16-2012 at 11:37 AM. Reason: Changed BOLD tags to CODE tags. Please use CODE tags around CODE in the future.

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