ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help Needed With Message Box (https://www.excelbanter.com/excel-programming/395826-help-needed-message-box.html)

nospaminlich

Help Needed With Message Box
 
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

JLGWhiz

Help Needed With Message Box
 
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.Offse t(0, -1).Value,
luRng, 2, False)
End If
MsgBox y
End Sub

"nospaminlich" wrote:

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


JLGWhiz

Help Needed With Message Box
 
I assume you know that goes in the sheet code module.

"nospaminlich" wrote:

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


Bill Renaud

Help Needed With Message Box
 
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.
--
Regards,
Bill Renaud





All times are GMT +1. The time now is 06:56 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com