Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Automaticlly Running Macro on Changed Cell

I have the following Module programmed in Excel and it
does exactly what I need it to do except run when ever a
cell is updated.

I need it to run whenever B9 - B60 is changed or E- E60
is changed. What do I need to do?

-Chris

Sub CheckStatus()
Dim H33, H34, Status1, Status2

H33 = Cells(33, 8).Value
H34 = Cells(34, 8).Value

Select Case H33
Case 7
Status1 = "Verbal"
Case 8
Status1 = "Written"
Case 9
Status1 = "Termination"
Case Else
Status1 = ""
End Select

Select Case H34
Case 7
Status2 = "Verbal"
Case 8 To 11
Status2 = "Written"
Case 12
Status2 = "Termination"
Case Else
Status2 = ""
End Select
If H33 H34 Then
Range("H36").Value = Status1
Else
Range("H36").Value = Status2
End If
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Automaticlly Running Macro on Changed Cell

Right click on the worksheet tab and select view code. Paste in code like
the below into the Sheet module which is presented.

Private Sub Worksheet_Change(ByVal Target As Range)
if target.count 1 then exit sub
if not intersect(Target,Range("B9:B60,E9:E60")) is nothing then
CheckStatus
End if
End Sub

--
Regards,
Tom Ogilvy


"Chris" wrote in message
...
I have the following Module programmed in Excel and it
does exactly what I need it to do except run when ever a
cell is updated.

I need it to run whenever B9 - B60 is changed or E- E60
is changed. What do I need to do?

-Chris

Sub CheckStatus()
Dim H33, H34, Status1, Status2

H33 = Cells(33, 8).Value
H34 = Cells(34, 8).Value

Select Case H33
Case 7
Status1 = "Verbal"
Case 8
Status1 = "Written"
Case 9
Status1 = "Termination"
Case Else
Status1 = ""
End Select

Select Case H34
Case 7
Status2 = "Verbal"
Case 8 To 11
Status2 = "Written"
Case 12
Status2 = "Termination"
Case Else
Status2 = ""
End Select
If H33 H34 Then
Range("H36").Value = Status1
Else
Range("H36").Value = Status2
End If
End Sub



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
my excel settings changed and i have only 1 instance running. Melissa Setting up and Configuration of Excel 1 March 28th 10 04:30 AM
all cells in 2 workbooks have automaticlly changed to date format dloc Excel Worksheet Functions 0 February 11th 10 11:30 PM
Running Macro when a cell value changes Ayo Excel Discussion (Misc queries) 1 April 18th 07 03:09 PM
Running a macro on cell value change Mike Excel Discussion (Misc queries) 0 March 28th 07 01:13 AM
run macro automatically when cell content is changed? Kathrine Excel Worksheet Functions 1 March 22nd 07 10:44 PM


All times are GMT +1. The time now is 08:43 AM.

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"