Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Run Macro when Cell changes

this worked perfect

--
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
Macro to transfer contents of 'Selected' cell to alternate cell. Gryndar Excel Worksheet Functions 7 December 20th 08 09:58 PM
'IF' Macro to insert cell contents to alternate cell if cell not e Gryndar Excel Worksheet Functions 6 December 20th 08 05:02 PM
using a cell value to control a counter inside a macro and displaying macro value ocset Excel Worksheet Functions 1 September 10th 06 05:32 AM
Please help! Macro to change cell contents based on cell to the left Jennifer[_8_] Excel Programming 7 March 4th 04 01:06 AM
Question: Cell formula or macro to write result of one cell to another cell Frederik Romanov Excel Programming 1 July 8th 03 03:03 PM


All times are GMT +1. The time now is 06:56 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"