×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Which event?

Which event?

Which event?

(OP)
I want to dynamically update some information in a excel spreadsheet but I cannot seem to find a suitable event to trigger my code.

When I enter data into a cell and then change selection, I want to run some code that picks up the data in the cell I just typed into.

Playing around, I have tried the 'SheetSelectionChanged' event but the 'Target' object refers to the cell I am now on and not the cell I had just typed into.

The 'SheetCalculate' event only triggers when there is a formula being updated to that is no good either.

Can someone point me in the right direction please?

Thanks

RE: Which event?

Have you tried the Worksheet_Change event?

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein

RE: Which event?

(OP)
Thanks, but it didn't seem to work.

I have the code in ThisWorkbook module as I need this code to run on every worksheet!!

I cannot believe other people have not wanted to do a similar thing?
 

RE: Which event?

==> I have the code in ThisWorkbook module as I need this code to run on every worksheet!!
That may be the problem because it's not a workbook event.  It's a worksheet event, and the code needs to be in the worksheet in which it applies.

If you need it to fire for every worksheet, then you'll probably need to insert the code into every worksheet.  That being said, if the actual logic inside the event is the same, then you can make that a public subroutine in the workbook module, and simply use a one-line call in each and every worksheet event handler.  Then it's a simple copy and paste to all other worksheets.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein

RE: Which event?

You can accomplish the same using the Workbook_SheetChange event in the ThisWorbook module.

CODE

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
MsgBox ("You changed " & Sh.Name & " cell " & Target.Address)
End Sub

Cheers,
Joerd

Please see FAQ731-376: Eng-Tips.com Forum Policies for tips on how to make the best use of Eng-Tips.

RE: Which event?

(OP)
That seems to do the trick.  Thanks :)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login



News


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close