Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-28-2019, 05:14 AM
NoSparks NoSparks is offline search 2 sheets for match Windows 7 64bit search 2 sheets for match Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

untested, but maybe something like



Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim C As Range
'limit to single cell
If Target.Count > 1 Then Exit Sub
'monitor specific range
If Intersect(Target, Range("H4:H5000")) Is Nothing Then Exit Sub
'dealing with the entry
If Target.Value <> "" Then
    'search this sheet
    With Sheets("Clipsal Customer")
        Set C = .Range("H4:H" & Target.Row - 1).Find(What:=Target.Value, LookIn:=xlValues, LookAt:=xlWhole, MatchCase:=False)
    End With
    
    If C Is Nothing Then     ' meaning it was NOT found, so...
                             ' search the other sheet
        With Sheets("whatever its name is")
            Set C = .Range("whatever the range is").Find(What:=Target.Value, LookIn:=xlValues, LookAt:=xlWhole, MatchCase:=False)
        End With
    End If
    
    If Not C Is Nothing Then
        'copy from C.row to Target.row
        Application.EnableEvents = False
        Target.Offset(, 1).Resize(, 4).Value = C.Offset(, 1).Resize(, 4).Value
        Target.Offset(, 17).Resize(, 9).Value = C.Offset(, 17).Resize(, 9).Value
        Application.EnableEvents = True
    Else
        MsgBox Target.Value & "  was not found."
    End If
        
End If
End Sub
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Search and Paste for accounts on 2 sheets Brian13 Excel Programming 1 06-05-2017 09:59 PM
search 2 sheets for match Trying to match values across multiple sheets coxyada Excel 2 12-13-2016 03:44 PM
search 2 sheets for match Using If function in VBA to match data from two sheets cinstanl Excel Programming 1 12-06-2016 10:37 AM
compare, match and count cell contents between sheets bobsone1 Excel 11 08-07-2014 10:34 PM
If two geographical data match in two sheets, copy unique id/code found in one sheet alliage Excel 1 09-01-2011 05:23 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:00 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft