Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Selecting A Cell Value And Displaying A Popup Or Tooltip

Hi Gang

I need to display messages to a user when they select certain values
in a cell. The cell data comes from a validated data list. Here's a
simple example. Say I have a list in a cell that shows the values
Yellow, Grey, Red, Blue and Green. When they select Blue, I want a
popup or a tooltip to show saying "You picked a great colour".

Can I do this in Excel?

Thanks
Andy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 421
Default Selecting A Cell Value And Displaying A Popup Or Tooltip

Hi Andy,

Try something like:
'==========
Option Explicit

Private Sub Worksheet_SelectionChange( _
ByVal Target As Range)
Dim Rng As Range
Dim arrColours As Variant
Dim arrMsg As Variant
Dim msg As String
Dim i As Long, j As Long
Dim Res As Variant

If Selection.Count 1 Then
Exit Sub
End If

Set Rng = Me.Range("A1:A10") '<<==== CHANGE

On Error Resume Next
Set Rng = Intersect(Rng, Target)
On Error GoTo 0

If Not Rng Is Nothing Then
arrMsg = VBA.Array("Excellent colour", _
"Great selection!", _
"Good choice", _
"Selelection could be better!", _
"I will hold my tongue!")

arrColours = VBA.Array("Blue", _
"Green", _
"Yellow", _
"Red", _
"Grey")

Res = Application.Match(Rng.Cells(1).Value, arrColours, 0)

If Not IsError(Res) Then
MsgBox Prompt:=arrMsg(Res - 1), _
Buttons:=vbInformation, _
Title:="Demo"
End If
End If
End Sub
'<<==========


This is worksheet event code and should be pasted
into the worksheets's code module (not a standard
module and not the workbook's ThisWorkbook module):

Right-click the worksheet's tab
Select 'View Code' from the menu and paste the code.
Alt-F11 to return to Excel.



---
Regards,
Norman


"Andy" wrote in message
...
Hi Gang

I need to display messages to a user when they select certain values
in a cell. The cell data comes from a validated data list. Here's a
simple example. Say I have a list in a cell that shows the values
Yellow, Grey, Red, Blue and Green. When they select Blue, I want a
popup or a tooltip to show saying "You picked a great colour".

Can I do this in Excel?

Thanks
Andy


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
Selecting data from columns and displaying them as rows chrisvail Excel Discussion (Misc queries) 2 October 7th 09 06:28 PM
Selecting vertical rows and displaying them horizontally. chrisvail Excel Discussion (Misc queries) 2 October 6th 09 11:48 PM
Excel2007Beta2: Selecting Range doesn't popup DesignTab PatrickV Excel Discussion (Misc queries) 2 May 25th 06 07:28 PM
Selecting answers from a list and displaying them Darin Kramer Excel Programming 6 March 21st 05 12:17 PM
Selecting & Displaying An Array's Contents Scott Excel Programming 0 February 20th 04 05:21 PM


All times are GMT +1. The time now is 01:02 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"