Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Running A Macro when data is updated.

To all,

I have a macro in a worksheet that I want to run when any data in
Column B changes. At the moment it is run by a button click. Is there
anyway to do this without rewriting the macro?

Thanks in advance,

Joseph Crabtree

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default Running A Macro when data is updated.

Hi
Put the code inside the Change or selection_Change events of your
sheet.

Private Sub Worksheet_Change(ByVal Target As Range)
'code
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'code
End Sub

To access these, click on the sheet tab in the VBE. Change the left
hand dropdown from General to Worksheet, and choose your event sub in
the right hand sheet. Highlight the sub name and click F1 to see some
examples, as it can be subtle (e.g you don't want the change to trigger
the change etc into an infinite loop).
regards
Paul


joecrabtree wrote:

To all,

I have a macro in a worksheet that I want to run when any data in
Column B changes. At the moment it is run by a button click. Is there
anyway to do this without rewriting the macro?

Thanks in advance,

Joseph Crabtree


Reply
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
Macro not running when cell value is updated Jon[_21_] Excel Programming 1 November 5th 05 06:22 AM
updated running total from previous pages Steve Excel Worksheet Functions 0 July 7th 05 02:06 AM
Running macro when changing data Pjotr Excel Programming 1 September 12th 04 08:40 AM
Running Event Procedure When Cell Updated on Excel Worksheet Tom Ogilvy Excel Programming 0 August 19th 04 03:38 PM
Can't update the data from internet while running macro wilson Excel Programming 3 November 10th 03 07:23 PM


All times are GMT +1. The time now is 06:33 AM.

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"