Thread
:
Event: Workbook_Change or Worksheet_Change
View Single Post
#
2
Posted to microsoft.public.excel.programming
Gary L Brown
external usenet poster
Posts: 219
Event: Workbook_Change or Worksheet_Change
Works fine for me. I added the UCase function just in case users enter a
small b instead of a Capital B.
'/---------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo err_Sub
If Target.Column < 19 Then Exit Sub
If UCase(Cells(Target.Row, Target.Column).Value) = "B" Then
MsgBox "It works."
End If
End Sub
'/---------------------------------------------------------------
HTH,
--
Gary Brown
If this post was helpful, please click the ''Yes'' button next to ''Was this
Post Helpfull to you?''.
"Han" wrote:
I am attempting to have some code executed whenever any row in column
"S" contains the letter "B". In other words, I would like the code to
run whenever the user enters a "B" in any row in column "S".
Nothing is happening when I enter a "B" in a random row in column "S"
to the best of my knowledge.
Promise, I have not exited the "Design Mode". Besides, my other macros
are running fine.
Note: I also attempted using worksheet_change event (nothing happened
still). A couple variations in code I have tried are below.
-----------------------------------------------------------------------------------
Private Sub Workbook_Change(ByVal Target As Range)
If Target.Column < 19 Then Exit Sub
If Cells(Target.Row, Target.Column).Value = "B" Then
MsgBox "It works...Not"
End If
End Sub
-----------------------------------------------------------------------------------
Also tried this among many other variations...
-----------------------------------------------------------------------------------
Private Sub Workbook_Change(ByVal Target As Range)
If Target.Column = 19 Then
If Cells(Target.Row, Target.Column).Value = "B" Then
MsgBox "It works...JK"
Else
Exit Sub
End If
End If
End Sub
-----------------------------------------------------------------------------------
Thoughts as to why the code doesn't seem to be doing anything?
Reply With Quote
Gary L Brown
View Public Profile
Find all posts by Gary L Brown