ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Show A userform on selection range (https://www.excelbanter.com/excel-programming/387755-show-userform-selection-range.html)

Sanjay[_2_]

Show A userform on selection range
 
Hi,

Is it possible to show a userform when the user selects a cell (enters the
cell), I can use the selectionchange but is there a on cell enter
/selection?

Thanks!




Norman Jones

Show A userform on selection range
 
Hi Sanjay, I am not sure that I understand your distinction between the
Selctionchange event and " on cell enter /selection" , but perhaps your
intention is to limit the event response to a single cell or range.

Try, therefo

'=============
Private Sub Worksheet_SelectionChange _
(ByVal Target As Range)
Dim rng As Range

Set rng = Me.Range("A1") '<<==== CHANGE

If Not Intersect(rng, Target) Is Nothing Then
UserForm1.Show
End If
End Sub
'<<=============

---
Regards,
Norman


"Sanjay" wrote in message
...
Hi,

Is it possible to show a userform when the user selects a cell (enters the
cell), I can use the selectionchange but is there a on cell enter
/selection?

Thanks!




Sanjay[_2_]

Show A userform on selection range
 
Thanks Norman,

What I'm after if possible is that when the user clicks a cell, the userform
is displayed, but at the moment the only option I can see is if the cell is
changed then the userform can be displayed.

Thanks!



"Norman Jones" wrote in message
...
Hi Sanjay, I am not sure that I understand your distinction between the
Selctionchange event and " on cell enter /selection" , but perhaps your
intention is to limit the event response to a single cell or range.

Try, therefo

'=============
Private Sub Worksheet_SelectionChange _
(ByVal Target As Range)
Dim rng As Range

Set rng = Me.Range("A1") '<<==== CHANGE

If Not Intersect(rng, Target) Is Nothing Then
UserForm1.Show
End If
End Sub
'<<=============

---
Regards,
Norman


"Sanjay" wrote in message
...
Hi,

Is it possible to show a userform when the user selects a cell (enters
the cell), I can use the selectionchange but is there a on cell enter
/selection?

Thanks!







Norman Jones

Show A userform on selection range
 
Hi Sanjay,

'-----------------
What I'm after if possible is that when the user clicks a cell, the userform
is displayed, but at the moment the only option I can see is if the cell is
changed then the userform can be displayed.
'-----------------

Have you tried the code?

The Worksheet_SelectionChange event responds to a change
in selection; the Worksheet_Change event responds to a (non
formula) value change.


---
Regards,
Norman



Sanjay[_2_]

Show A userform on selection range
 
Norman,

That's what I was after thanks again!

Regards,

Sanj


"Norman Jones" wrote in message
...
Hi Sanjay,

'-----------------
What I'm after if possible is that when the user clicks a cell, the
userform
is displayed, but at the moment the only option I can see is if the cell
is
changed then the userform can be displayed.
'-----------------

Have you tried the code?

The Worksheet_SelectionChange event responds to a change
in selection; the Worksheet_Change event responds to a (non
formula) value change.


---
Regards,
Norman







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

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