Help Needed With Message Box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I don't know if this is possible and if it is how I go about it but here
goes....

I have some data on a worksheet called Data

I have some summary info on another sheet called Summary

I want to have a message box appear when a user selects any cell in col D of
Summary where the message is the result of a lookup of the same row in Col C
against the range F1:G5000 in Data.

Hopefully this is clear but rather than pure text in the Message Box I want
the message to always be the formulaic result of
Vlookup(RC[-1],Data!F1:G5000,2,False)

How do I code that in the MsgBox () and how do I make the box appear for any
cell in Col D

Thanks a lot
 
I am not so sure that this is what you want. It will
only return the first occurence of the match to column
C of the source document to Column F of the search
document with value or Col G. But it does do that.

Private Sub Worksheet_Change(ByVal Target As Range)
Set x = Application.Intersect(Target, Columns("D"))
If Not x Is Nothing Then
luRng = Worksheets("Data").Range("F1:G5000")
y = Application.WorksheetFunction.VLookup(Target.Offset(0, -1).Value,
luRng, 2, False)
End If
MsgBox y
End Sub
 
It might be simpler to add another column to your Summary sheet, and
place the formula there that looks up the value on the Data worksheet.
Having message boxes pop up all of the time can get annoying after a
while. If the added column of data is not to be printed out, then hide
the column before printing.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top