Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Automatic Macro

Is it possible to make a macro run the moment a cell has been entere
into?

I know it can be done so the macro runs when you open and close a fil
but can it be done for after a cell has been changed?

If so whats the code

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Automatic Macro

Check out this site about events
http://www.cpearson.com/excel/events.htm

You can use the change event in a Sheet module

Right click on a sheet tab and choose view code
Paste the code there
Alt-Q to go back to Excel

If A1 change the macro "YourMacroName" will run

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("A1"), Target) Is Nothing Then
YourMacroName
End If
End Sub

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"ianripping " wrote in message ...
Is it possible to make a macro run the moment a cell has been entered
into?

I know it can be done so the macro runs when you open and close a file
but can it be done for after a cell has been changed?

If so whats the code?


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Automatic Macro

I do apologize. I meant to put this in the code for the workbook:

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target A
Range)
If Target.Column = 1 And Target.Row = 1 Then
MsgBox ("HI!")
End If
End Sub

- Piku

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Automatic Macro

Double-click the sheet you're using in your VBAProject to open the cod
window. Paste this in it:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target = Range("A1") Then

End If
End Sub

The code in the If Statement will only run if the particular Range yo
name was the "Target" of the change in the worksheet. - Piku

--
Message posted from http://www.ExcelForum.com

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
Automatic Formula or Macro Jessica Excel Worksheet Functions 2 July 20th 07 07:50 AM
Automatic run of Macro Frank Excel Discussion (Misc queries) 1 February 21st 07 03:10 PM
Automatic run of Macro Tom Ogilvy Excel Discussion (Misc queries) 0 February 21st 07 02:33 PM
Use IF function to automatic run macro YS Lee Excel Worksheet Functions 2 May 4th 06 08:12 PM
automatic macro execution Jos reulen Excel Programming 4 November 10th 03 03:10 PM


All times are GMT +1. The time now is 01:25 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"