![]() |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 09:51 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com