ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Managing User Changes (https://www.excelbanter.com/excel-programming/306387-managing-user-changes.html)

Peter[_44_]

Managing User Changes
 
Hi,
I am using VB.NET and have an app that does a DB query and displays the
results in excel. I want the app to monitor where the results are stored ie.
if the user inserts columns or rows the app still knows where the original
data is stored.

I can use the SheetChange event to monitor when a cell is changed, but I am
unsure about the best way to do this, particularly when the event is fired
for both the cut and paste operations.

Should I 'catch' the cut, store the details of contained cells, then 'catch'
the paste and update my app then?

If so, how can I tell what the user has done? Is there something saved
somewhere to highlight the operation?

Thanks for any help,
Peter.



Tom Ogilvy

Managing User Changes
 
Create a defined name that refers to the cell, then you can use that defined
name to refer to the cell.

Turn on the macro recorder while you do it manually to get the code.

Insert=Name=Define
Name: Range1
Refersto: =Sheet1!$B$9

then in code

msgbox Range("Range1").Address & " - " & Range("Range1").Value

--
Regards,
Tom Ogilvy

"Peter" wrote in message
...
Hi,
I am using VB.NET and have an app that does a DB query and displays the
results in excel. I want the app to monitor where the results are stored

ie.
if the user inserts columns or rows the app still knows where the original
data is stored.

I can use the SheetChange event to monitor when a cell is changed, but I

am
unsure about the best way to do this, particularly when the event is fired
for both the cut and paste operations.

Should I 'catch' the cut, store the details of contained cells, then

'catch'
the paste and update my app then?

If so, how can I tell what the user has done? Is there something saved
somewhere to highlight the operation?

Thanks for any help,
Peter.






All times are GMT +1. The time now is 03:27 PM.

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