ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Target Address Property for Insert/Delete Row/Column (https://www.excelbanter.com/excel-programming/427213-re-target-address-property-insert-delete-row-column.html)

Per Jessen

Target Address Property for Insert/Delete Row/Column
 
Hi EM

I assume you are working with an event code. Declare a variable at the very
top of the worksheet module to remember LastTarget.

Dim LastTarget As Range
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not LastTarget Is Nothing Then
MsgBox ("Current Target is " & Target.Address & vbLf & "Last Target was
" & LastTarget.Address)
End If
Set LastTarget = Target
End Sub

Hopes this helps

-Per

"Excel Monkey" skrev i meddelelsen
...
When I select call A1, the address property of the target is "$A$1". When
I
select A1 and then hit Delete/Insert Rows/Column, the target is set to
$1:$1.
However A1 is still selected visually (i.e. row 1 is not highlighted). I
am
assuming that this is Excel's way of addressing where to insert/delete the
new range.

I need to find a way of referencing what the single cell address was prior
to excel changing it. Any ideas

Thanks

EM




All times are GMT +1. The time now is 05:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com