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

Can I get a macro to start once a cell range is changed?

I want to validate fixed input to a cell which will provide a dropdown menu
of selections to pick from. My question is can I get a marco to run once a
new selection is entered into the cell.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Automatically starting macros

Right click on the sheet tab you want to react to the change and select view
code. Fust above the code window are 2 drop down menus. Change the one on the
left from General to Worksheet (A code stub will be added which we can delete
later). the drop down on the right now lists all of the events that you can
catch in a worksheet. Select the Change event and a code stub like this will
be added...

Private Sub Worksheet_Change(ByVal Target As Range)

End Sub

Target is a refence to the cell/s that have been changed so something like
this will catch a specific cell...

Private Sub Worksheet_Change(ByVal Target As Range)
if target.address = "$A$1" then msgbox target.value
End Sub
--
HTH...

Jim Thomlinson


"Shawn777" wrote:

Can I get a macro to start once a cell range is changed?

I want to validate fixed input to a cell which will provide a dropdown menu
of selections to pick from. My question is can I get a marco to run once a
new selection is entered into the cell.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Automatically starting macros

Thank you, it took a few trys but I got it to work.

"Jim Thomlinson" wrote:

Right click on the sheet tab you want to react to the change and select view
code. Fust above the code window are 2 drop down menus. Change the one on the
left from General to Worksheet (A code stub will be added which we can delete
later). the drop down on the right now lists all of the events that you can
catch in a worksheet. Select the Change event and a code stub like this will
be added...

Private Sub Worksheet_Change(ByVal Target As Range)

End Sub

Target is a refence to the cell/s that have been changed so something like
this will catch a specific cell...

Private Sub Worksheet_Change(ByVal Target As Range)
if target.address = "$A$1" then msgbox target.value
End Sub
--
HTH...

Jim Thomlinson


"Shawn777" wrote:

Can I get a macro to start once a cell range is changed?

I want to validate fixed input to a cell which will provide a dropdown menu
of selections to pick from. My question is can I get a marco to run once a
new selection is entered into the cell.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Automatically starting macros



"Shawn777" wrote:

Thank you, it took a few trys but I got it to work.

"Jim Thomlinson" wrote:

Right click on the sheet tab you want to react to the change and select view
code. Fust above the code window are 2 drop down menus. Change the one on the
left from General to Worksheet (A code stub will be added which we can delete
later). the drop down on the right now lists all of the events that you can
catch in a worksheet. Select the Change event and a code stub like this will
be added...

Private Sub Worksheet_Change(ByVal Target As Range)

End Sub

Target is a refence to the cell/s that have been changed so something like
this will catch a specific cell...

Private Sub Worksheet_Change(ByVal Target As Range)
if target.address = "$A$1" then msgbox target.value
End Sub
--
HTH...

Jim Thomlinson


"Shawn777" wrote:

Can I get a macro to start once a cell range is changed?

I want to validate fixed input to a cell which will provide a dropdown menu
of selections to pick from. My question is can I get a marco to run once a
new selection is entered into the cell.


I also wanted a macro to run automatically, but when a particular worksheet
is opened. The Worksheet - Activate selection worked fine. Each time I now
open the worksheet the marco automatically updates its data analysis from
another worksheet. Great !
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Automatically starting macros



"Shawn777" wrote:

Can I get a macro to start once a cell range is changed?

I want to validate fixed input to a cell which will provide a dropdown menu
of selections to pick from. My question is can I get a marco to run once a
new selection is entered into the cell.


See the other answers about Worksheet Change. It also works if you want a
macro to run when the sheet is activated. Choose Worksheet - Activate and put
your code there. I have it to automatically update an analysis of data from
another sheet.


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
Starting a Makro automatically [email protected] Excel Discussion (Misc queries) 5 July 24th 06 12:19 PM
Automatically starting code Richard Excel Worksheet Functions 3 February 8th 06 02:33 AM
Automatically starting a macro moorso Excel Programming 17 June 21st 05 12:59 AM
Starting macros when cell changes to TRUE THW Excel Programming 1 June 17th 05 08:56 PM
starting macros via scheduled tasks mnichols Excel Programming 1 May 24th 04 09:37 AM


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