LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default use vb to determine last cell changed

On Oct 4, 12:15*pm, Mike H wrote:
Hi,

Right click your sheet tab, view code and paste this in.

the messagebox bit isn't necessary, it's to demonstrate the method

Private Sub Worksheet_Change(ByVal Target As Range)
MsgBox "Last changed cell was " & Target.Address
Application.EnableEvents = False
Cells(Target.Row, 2).Value = "Something"
Application.EnableEvents = True
End Sub

Mike



" wrote:
Is it possible for VB to determine the last cell that was changed. I'm
not referring to a cell changed by a macro, just a cell that was
changed by typing into the cell. I want a macro to then update a cell
in the same row, column B.


Thanks- Hide quoted text -


- Show quoted text -


Mike,

I've finally found some time to follow up on the suggestions in this
string (Rick, I'll try your idea soon).

For your suggestion I'm learning some more new stuff. I've never put
code on a worksheet tab so I've got to understand that better.

The message box indeed displays the cell just changed. That's cool!

So now I have this Private Sub on a sheet (code) and my original
macro1() on a module1 (code).

I think the target.row will get updated everytime new data is entered
in a cell. And your code went on to further enter something in column
B of that row, but I don't want to update cell B just yet.

I may have several cells in the row I want to change, and then when I
am done invoke the macro, which first needs to check that it is in the
right row, and then update the cell in column B. (The purpsoe of my
original request was a form of an error check. When users enter data
they can use the enter key or a tab key. In one case the active cell
is left in the wrong row.)

So, I think to use your method I need to understand how to pass the
value of the target to my macro. is this possible?

Did my description make any sense?

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I need a formula to determine when the data was last changed Climber of Mtns[_2_] Excel Discussion (Misc queries) 0 December 4th 09 09:51 PM
Determine if the sheet has been changed Erik Wikström[_2_] Excel Programming 2 December 12th 07 03:00 PM
determine if a cell changed value Dave01 Excel Worksheet Functions 0 July 8th 05 04:49 PM
in vba what command is used to determine if a particular cell on a particular sheet changed? some kind of event? how to get the old and new value of the cell? Daniel Excel Worksheet Functions 1 June 23rd 05 07:53 PM
How can I determine which cell changed as a result of a calculati. Asaf Excel Worksheet Functions 6 February 15th 05 12:17 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"