Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Worksheet_SelectionChange | Excel Programming | |||
Worksheet_SelectionChange | Excel Programming | |||
Worksheet_SelectionChange | Excel Programming | |||
Worksheet_SelectionChange | Excel Programming | |||
Worksheet_SelectionChange | Excel Programming |