+ Reply to Thread
Results 1 to 2 of 2

Searching Sheet2 to find a match on Sheet1

Hybrid View

  1. #1
    Registered User
    Join Date
    01-18-2006
    Posts
    12

    Searching Sheet2 to find a match on Sheet1

    My problem is that I have a value in A1 on Sheet1 and I need to Search Sheet2 in Column A to last row of data and if there is a match then open UserForm2.

    Private Sub CommandButton2_Click()
    Dim LastRow As Long
    LastRow = Range("A1").End(xlDown).Row
    ' If Sheet1 A1 Match anything on sheet2 column A then
    If Sheet1.Range("A1") = Sheet2.Range("A2").LastRow Then
    'Open UserForm2 with that ID
    UserForm2.Show vbModeless
    End If
    End Sub

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Searching Sheet2 to find a match on Sheet1

    Why have you marked this solved?
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ 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