Retrieve last input from user

mr2bart

Board Regular
Joined
Dec 18, 2014
Messages
57
Hi All,

I am searching for a way to retrieve in Excel VBA 2 points when user had input new data in a worksheet:
1. how to retreive what user had input ?
2. how to retreive where (address or range) user did this input?

Currently I use activecell but it's not right because when you valid your input, you can use arrows, return key or even click on other cell. So it works only if I have validation with drop list on cell modified.


Any help will be appreciate.


Thanks in advance!
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Is there a certain range that this input would happen on? What do you want to do with this information, write it to another sheet or what?
 
Upvote 0
Hi Scott, the most important thing is to retreive on which cell address this input was done. Depending this cell address, I will do different things in macro on some other place.
My actual macro works on all cases (paste a range of data <= I can retreive the active selection of cells, using arrows and return key because I check cells around <= cell up,down,right,left) except one case, if user input something on cell then click on a cell far away from the input. So I think the only way I have is to get a VBA function that detect last input information. I hope I am more clear :-)
 
Upvote 0
If you put this Macro in the ThisWorkbook Section in the VBA editor, it will tell you what cells have changed and what sheet it happened on. If you need it more fine-tuned than that you need to supply some more specific details.

Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim c As Range
MsgBox "Sheet Name: " & Sh.Name
For Each c In Target
    MsgBox "Cell " & c.Address & " changed"
Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,816
Messages
6,181,139
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top