Floating Text Box help

  • Thread starter Ty Barrett (VMC)
  • Start date
T

Ty Barrett (VMC)

Hello I have a question on how to execute what in my mind is easy to conceive
but hard to execute. I have a Test Case spreadsheet and I want to implement a
way for it to appear more streamlined.

What I want to implement is a floating text box that only appears when the
user highlights one of the cells. This floating text box should appear in the
middle of the screen and only appear when the user highlights one of the
cells on the Excel Spreadhsheet.

Can anyone help me with this?

Thank You

Ty Barrett
 
C

Chip Pearson

The simplest way is to create a UserForm with a text box on it, and use the
SelectionChange event to display or hide the form based on the cell selected
by the user. For example, the following code in the Sheet1 module will
display the form if the user clicks in the range name "TheRange" and hide
the form when the user selects a cell outside that range.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count > 1 Then
Exit Sub
End If
If Not Application.Intersect(Range("TheRange"), Target) Is Nothing Then
UserForm1.Show vbModeless
Else
UserForm1.Hide
End If
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)
 
T

Ty Barrett (VMC)

Thank you very much Chip. I am going to implement this to the best of my
ability and get back to you. Thanks again for the help!
 

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

Top