Vlookup and Intersect

niha

New Member
Joined
May 6, 2021
Messages
19
Office Version
  1. 2019
Platform
  1. Windows
Hi Guys,
Im working on making a dashboard which requires that as soon as I enter a value in my dashboard sheet in column E, it should find that value in another sheet called data and take up the value from the column adjacent to it and paste it in my dashboard sheet after one column. Im working on a project and need this really badly. This is the code Im using now. Please help

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

On Error GoTo MyErrorHandler:

result = Application.WorksheetFunction.Vlookup(Cells(ActiveCell.Row, "E"), Sheets("Data").Range("B:C"), 2, False)

ActiveCell.Offset(0, 2).Value = result

MyErrorHandler:
If Err.Number = 1004 Then
ActiveCell.Offset(0, 2).Value = ""
End If

End Sub
 
If Not Application.Intersect(Target, Range("K16:K1000")) Is Nothing Then******** This is the line in the code
This should also be a separate post. See if the below gets you by otherwise you need to log it as a separate question.

VBA Code:
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
    
    'Audit
    Dim vbAns As VbMsgBoxResult
    
    If Not Intersect(Target, Range("J6:J1000")) Is Nothing Then
        vbAns = MsgBox("Did you check the locations manually?", vbYesNo, "Manual Audit")
     
        If vbAns = vbYes Then
            ActiveCell.Value = "Done"
        End If
     
        If vbAns = vbNo Then
            MsgBox "Please check the locations manually first to ensure FIFO."
        
        End If
        
    End If

    'Breach Resolve

    Dim vbAnswer As VbMsgBoxResult
    
    If Not Intersect(Target, Range("K16:K1000")) Is Nothing Then
        vbAnswer = MsgBox("Did you resolve the breach?", vbYesNo, "Breach Check")
     
         If vbAnswer = vbYes Then
            ActiveCell.ClearContents
            ActiveCell.Interior.Color = RGB(255, 255, 255)
         End If
         
        If vbAnswer = vbNo Then
            MsgBox "Please check the location manually to resolve the breach"
        End If
    End If

End Sub
 
Upvote 0

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Forum statistics

Threads
1,215,045
Messages
6,122,830
Members
449,096
Latest member
Erald

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top