Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Input Message macro

Excel 2000

Dear all

I guess my last post was too extensive and explained well enough.

I came across this code as a solutions to somebody else's problem.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address = "$A$1" Then
'
' Code to determine or select message text goes here
'
Message = "This is the message text"
Target.Validation.InputMessage = Message
End If
End Sub

How can I adjust this macro so that the Input message shows the result of a
vlookup formula based on the first three digits of the Active.Cell. The
worsheet formula I have used for the vlookup part is :

=VLOOKUP(INDIRECT(CELL("address")),testrange,2,FAL SE)

Regards

George





  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Input Message macro


Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error Goto ws_exit
Application.EnableEvents = False
If Target.Address = "$A$1" Then
Target.Value = Application.VLOOKUP(Target.Value, _
Range("testrange"),2,FALSE)
End If

ws_exit:
Application.EnableEvents = True
End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"George Andrews" wrote in message
...
Excel 2000

Dear all

I guess my last post was too extensive and explained well enough.

I came across this code as a solutions to somebody else's problem.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address = "$A$1" Then
'
' Code to determine or select message text goes here
'
Message = "This is the message text"
Target.Validation.InputMessage = Message
End If
End Sub

How can I adjust this macro so that the Input message shows the result of

a
vlookup formula based on the first three digits of the Active.Cell. The
worsheet formula I have used for the vlookup part is :

=VLOOKUP(INDIRECT(CELL("address")),testrange,2,FAL SE)

Regards

George







  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Input Message macro

Hi

I copied and pasted your code into my VBA project on the relevant sheet. and
nothing happens.

I will repeat what I am looking to do in case I have not been clear.

When I click on a cell (ActiveCell) I would like a box to appear with the
result of a formula (based on a vlookup formula which looks up the value in
the ActiveCell in a table "testrange", column 2). The type of box that I
would like to see is like the one that appears when you use
DataValidationInput Message

Can anybody help me with this code.

Regards

George





"Bob Phillips" wrote in message
...

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error Goto ws_exit
Application.EnableEvents = False
If Target.Address = "$A$1" Then
Target.Value = Application.VLOOKUP(Target.Value, _
Range("testrange"),2,FALSE)
End If

ws_exit:
Application.EnableEvents = True
End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"George Andrews" wrote in message
...
Excel 2000

Dear all

I guess my last post was too extensive and explained well enough.

I came across this code as a solutions to somebody else's problem.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address = "$A$1" Then
'
' Code to determine or select message text goes here
'
Message = "This is the message text"
Target.Validation.InputMessage = Message
End If
End Sub

How can I adjust this macro so that the Input message shows the result

of
a
vlookup formula based on the first three digits of the Active.Cell. The
worsheet formula I have used for the vlookup part is :

=VLOOKUP(INDIRECT(CELL("address")),testrange,2,FAL SE)

Regards

George









Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you move the input message? dunnL1 Excel Discussion (Misc queries) 4 March 6th 08 07:34 PM
Message or input thesaxonuk Excel Discussion (Misc queries) 4 October 25th 06 09:38 AM
Data Validation Input Message Sandy Excel Worksheet Functions 1 March 8th 06 03:19 PM
Can VBA accept input from a message box? dougmcc1[_7_] Excel Programming 1 October 7th 04 10:48 PM
input message tamersaid Excel Programming 1 June 6th 04 02:06 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"