Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
userform and events
Hello. I have a user form with a text box that shows currently selected cell. If a user clicks on another cell I want the text box to be updated with that cell address. I tried using Private Sub Worksheet_SelectionChange(ByVal Target As Range). But I don't know where to put it because nothing happens when the cell is clicked. Do I need to create a class? Here's how my subs look: Option Explicit Dim clAdr As String Private Sub UserForm_Initialize() clAdr = ActiveCell.Address(rowabsolute:=False, columnabsolute:=False) UserForm1.TextBox1.Text = clAdr End Sub Private Sub Worksheet_SelectionChange(ByVal Target As Range) Application.EnableEvents = False If Target.Address < UserForm1.TextBox1.Text Then UserForm1.TextBox1.Text = Target.Address End If Application.EnableEvents = True End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Events in a Userform | Excel Programming | |||
UserForm ListBox Events | Excel Programming | |||
Multipage Userform Events | Excel Programming | |||
UserForm events | Excel Programming | |||
UserForm Events | Excel Programming |