+ Reply to Thread
Results 1 to 1 of 1

Compare 2 column of data set

  1. #1
    Registered User
    Join Date
    07-09-2015
    Location
    Malaysia
    MS-Off Ver
    2010
    Posts
    1

    Compare 2 column of data set

    Hey, I have a data which is Type and Link, The link a and b which is from different type will connect to different file, so it is a hyperlink. To simplify it, I use pivot table. Here is the code I use to link my data to hyperlink in pivot table:
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim selPF As PivotField
    Dim selPF1 As PivotField
    Dim rg As Range
    Dim strField As String
    Dim rgLinks As Range
    Dim lMatch As Long

    strField = "Link"
    Set rgLinks = Sheets("sheet3").Range("Table1[Link]")
    On Error Resume Next
    Set selPF = Target.PivotField
    If Not selPF Is Nothing Then
    If PivotTables("PivotTable2").PivotField.PivotItems("'Basic Type'[All]") = Sheets("sheet3").Range("Table1[Basic Type]") Then
    If selPF.Name = strField Then
    lMatch = Application.Match(Target.Value, rgLinks, 0)
    If lMatch > 0 Then ThisWorkbook.FollowHyperlink Address:=rgLinks.Cells(lMatch).Hyperlinks(1).Address, NewWindow:=True
    End If
    End If
    End If
    End Sub

    Data:
    Type Link
    1 a
    1 b
    2 a
    2 b
    3 a
    3 b

    The problem is my a and b with different type are all link to a and b type 1. How should I modified the code so that it will compare with the original data 'type'?, if the type is same, then only link it.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Compare Data in 2 Columns in 2 sheet When there is a match transfer data from 2nd Column
    By kellyjo7 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-19-2015, 01:05 PM
  2. [SOLVED] Compare 1 column with another column and match data in next column
    By screambeam in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-26-2015, 02:49 AM
  3. Is there a way to compare data of column 1 with column 3 and place it next to column 1?
    By SRINIVAS THANTHRI in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-19-2014, 12:59 PM
  4. Replies: 6
    Last Post: 01-08-2014, 01:56 PM
  5. Replies: 1
    Last Post: 01-15-2013, 01:23 PM
  6. Compare data from a column in a crystal report to a column in excel and post data
    By dkrzysik in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-31-2012, 02:02 PM
  7. [SOLVED] Compare Column 1 to Col 2, if data in Col1 = Col2, remove the row containing that data
    By Trevasaurus in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-04-2012, 05:28 PM

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