LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default 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
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
Events in a Userform Trefor Excel Programming 2 March 17th 06 03:09 PM
UserForm ListBox Events David Excel Programming 0 November 1st 05 01:56 PM
Multipage Userform Events SA3214 Excel Programming 7 April 13th 05 09:03 PM
UserForm events R Avery Excel Programming 5 August 19th 04 05:59 PM
UserForm Events Nigel[_6_] Excel Programming 1 February 22nd 04 12:19 PM


All times are GMT +1. The time now is 06:36 AM.

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"