create a yellow popup window

MetLife

Active Member
Joined
Jul 2, 2012
Messages
330
Office Version
  1. 365
Hi,

I wanted to create a yellow pop up window when I click on the rows in a particular table.

I have seen this done but can't find the initial code to get me started.

Does anyone have the basic structure to use?

Thanks
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
When you say
a yellow pop up window
what kind of window are you talking about? Is it a message box, a user form, etc?
 
Upvote 0
An input box is used to get a response from the user. For example: the message in the pop-up could say "Please enter your name." The link you provided explains how to use Data Validation to display a message when you select any cell in your desired range. Perhaps you could explain in detail, step by step, what you are trying to do.
 
Last edited:
Upvote 0
I want to create the message "Hello" with font size 15 when the user clicks on cell A1.

The type of box is in the link.

Thanks
 
Upvote 0
I don't think that you can change the font size of the message if you use Data Validation. You would have to create a userform with a textbox and set the font size using the Font Property of the textbox. Then in the worksheet code module, you would need a macro such as this:
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Intersect(Target, Range("A1:A10")) Is Nothing Then Exit Sub
    UserForm1.Show
End Sub
which will show the userform when you click on any cell in the target range. Is it worth doing all this just for a font change?
 
Last edited:
Upvote 0
I don't think that you can change the font size of the message if you use Data Validation. You would have to create a userform with a textbox and set the font size using the Font Property of the textbox. Then in the worksheet code module, you would need a macro such as this:
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Intersect(Target, Range("A1:A10")) Is Nothing Then Exit Sub
    UserForm1.Show
End Sub
which will show the userform when you click on any cell in the target range. Is it worth doing all this just for a font change?

The font size is important because the text in the userform equals the range in another sheet. So the text can vary a lot.

Maybe a userform is better than the data validation box.
 
Upvote 0
If you want to change the font size, a userform is the way to go. You can also add the yellow background color to the textbox if you like. As well, you can increase the size of the textbox or decrease the size of the userform to make it look as you would like.
 
Upvote 0
.
The pop-up box you are referring to is called a COMMENT.

Right click the cell in question, select INSERT COMMENT.

Type the desired message.

Click and hold the left mouse button and highlight all the text in the COMMENT box. Then, using the HOME TAB up top, select the FONT TYPE and SIZE desired.

Press ENTER.
 
Upvote 0
Try this:
This is an auto sheet event script
Your Workbook must be Macro enabled
To install this code:
Right-click on the sheet tab
Select View Code from the pop-up context menu
Paste the code in the VBA edit window

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 1 And Target.Row = 1 Then
Dim cmt As Comment
  Set cmt = Target.Comment
    If cmt Is Nothing Then
        Target.AddComment "Hello"
        Target.Comment.Shape.TextFrame.Characters.Font.Size = 15
    Else
        Target.Comment.Delete
        Target.AddComment "Hello"
        Target.Comment.Shape.TextFrame.Characters.Font.Size = 15
    End If
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,305
Members
452,633
Latest member
DougMo

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