Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run Macro when Cell changes
Hello,
I have a validation list in column A and I would like to run a macr when someone changes the value of column A. I imagine it is a chang event, but I am unsure how to make this happen? Help. Thanks, E2 -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run Macro when Cell changes
Hi Eager,
Use the Worksheet_Change event. If you want something to happen when cell value changes in column A use code like: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 1 Then MsgBox ("Row " & Target.Row & " in column A has changed to value: & Target.Value) End If End Sub Good luc -- Message posted from http://www.ExcelForum.com |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run Macro when Cell changes
In addition ...
'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Binzelli " wrote in message ... Hi Eager, Use the Worksheet_Change event. If you want something to happen when a cell value changes in column A use code like: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 1 Then MsgBox ("Row " & Target.Row & " in column A has changed to value: " & Target.Value) End If End Sub Good luck --- Message posted from http://www.ExcelForum.com/ |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run Macro when Cell changes
Thanks for the replies! So, if I wanted a nested if for when Column A
"OPEN" do xxxx , or if Column A = "CLOSE" do xxxx, or Column A "PENDING" do xxxx. Each of the xxxx's would be a lot of code for things to take place. How would I code that? Thanks again! E2 -- Message posted from http://www.ExcelForum.com |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run Macro when Cell changes
Eager2Learn
You could use IF statements or SELECT CASE statements In My example it will only trigger the SELECT CASE commands if th change is in column A and only 1 cell has been changed - will not ru the SELECT CASE commands if f the user pastes data into multiple cell Private Sub Worksheet_Change(ByVal Target As Excel.Range) If Target.Column = 1 And Target.Count = 1 Then Select Case Target.Value Case "Open" ' open commnds here ' or call a sub routine Case "Closed" ' close commnds here ' or call a sub routine Case "Pending" ' pending commnds here ' or call a sub routine Case "" Exit Sub Case Else MsgBox "Unknown Text Entry" End Select End If End Su -- Message posted from http://www.ExcelForum.com |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Run Macro when Cell changes
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to transfer contents of 'Selected' cell to alternate cell. | Excel Worksheet Functions | |||
'IF' Macro to insert cell contents to alternate cell if cell not e | Excel Worksheet Functions | |||
using a cell value to control a counter inside a macro and displaying macro value | Excel Worksheet Functions | |||
Please help! Macro to change cell contents based on cell to the left | Excel Programming | |||
Question: Cell formula or macro to write result of one cell to another cell | Excel Programming |