Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
a a is offline
external usenet poster
 
Posts: 51
Default Worksheet_SelectionChange Question

Hello,

I've been trying to use the code for the individual worksheet for the
selection change:

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)

Here is a small piece of the code

Set mc1 = Selection
MsgBox mc1.Address(RowAbsolute:=True, columnabsolute:=True,
ReferenceStyle:=xlR1C1)

My problem is that I want to get the address of the selection before the
user hits enter. Is there a way to do this?

Thanks in advance for any help that you can offer.

A

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Worksheet_SelectionChange Question

ActiveCell.Address will give you the information e.g.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("a1") = ActiveCell.Address
End Sub

A1 will change to show the selected cell's address


"a" wrote in message
ink.net...
Hello,

I've been trying to use the code for the individual worksheet for the
selection change:

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)

Here is a small piece of the code

Set mc1 = Selection
MsgBox mc1.Address(RowAbsolute:=True, columnabsolute:=True,
ReferenceStyle:=xlR1C1)

My problem is that I want to get the address of the selection before the
user hits enter. Is there a way to do this?

Thanks in advance for any help that you can offer.

A



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Worksheet_SelectionChange Question

Target.address

will give you that location as soon as they make the change.

a wrote:

Hello,

I've been trying to use the code for the individual worksheet for the
selection change:

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)

Here is a small piece of the code

Set mc1 = Selection
MsgBox mc1.Address(RowAbsolute:=True, columnabsolute:=True,
ReferenceStyle:=xlR1C1)

My problem is that I want to get the address of the selection before the
user hits enter. Is there a way to do this?

Thanks in advance for any help that you can offer.

A


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Worksheet_SelectionChange Question

You mean you want the "old" address, not the "new" address referred to by
Target.Address ?

Save cell or address to a module level variable in the SelectionChange event

Dim OldAddress As String

Private Sub Worksheet_Activate()
OldAddress = ActiveCell.Address
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
MsgBox "New address : " & Target.Address & vbNewLine & "Old address : " &
OldAddress
OldAddress = Target.Address
End Sub

NickHK

"a" wrote in message
ink.net...
Hello,

I've been trying to use the code for the individual worksheet for the
selection change:

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)

Here is a small piece of the code

Set mc1 = Selection
MsgBox mc1.Address(RowAbsolute:=True, columnabsolute:=True,
ReferenceStyle:=xlR1C1)

My problem is that I want to get the address of the selection before the
user hits enter. Is there a way to do this?

Thanks in advance for any help that you can offer.

A



Reply
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
Worksheet_SelectionChange Gary''s Student Excel Programming 3 April 5th 06 09:46 AM
Worksheet_SelectionChange mangesh_yadav[_144_] Excel Programming 0 October 25th 04 12:56 PM
Worksheet_SelectionChange mangesh_yadav[_143_] Excel Programming 1 October 25th 04 11:49 AM
Worksheet_SelectionChange Rasmus[_2_] Excel Programming 2 June 27th 04 07:19 PM
Worksheet_SelectionChange Bill Oertell[_2_] Excel Programming 8 April 23rd 04 05:18 AM


All times are GMT +1. The time now is 10:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"