Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
From the worksheet code window, I am trying to identify when certain cells are modified and execute various functions according to different criteria. I am trying to do this by using a case statement based on the value of Target.Column, but nothing seems to be happening (no errors coming up, but not the result I was expecting either). I have: Private Sub Worksheet_Change(ByVal Target As Range) Select Case Target Case Target.Column = 3 MsgBox ("column" & Target.Column) Case Target.Column = 4 MsgBox("column" & Target.Column) End Select Obviously, in the final code, MsgBox willbe replaced by stuff that actually does useful things, but for now can someone tell me how to get this working, and if it won't how can I achieve this sort of result (it needs to be based on the column modified) TIA Dave |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You were very close
Private Sub Worksheet_Change(ByVal Target As Range) Select Case Target.Column Case Is = 3 MsgBox ("column" & Target.Column) Case Is = 4 MsgBox ("column" & Target.Column) Case Else 'Do something else End Select End Sub Mike "Risky Dave" wrote: Hi, From the worksheet code window, I am trying to identify when certain cells are modified and execute various functions according to different criteria. I am trying to do this by using a case statement based on the value of Target.Column, but nothing seems to be happening (no errors coming up, but not the result I was expecting either). I have: Private Sub Worksheet_Change(ByVal Target As Range) Select Case Target Case Target.Column = 3 MsgBox ("column" & Target.Column) Case Target.Column = 4 MsgBox("column" & Target.Column) End Select Obviously, in the final code, MsgBox willbe replaced by stuff that actually does useful things, but for now can someone tell me how to get this working, and if it won't how can I achieve this sort of result (it needs to be based on the column modified) TIA Dave |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Mike,
My thanks. One day I'll get the hang of this :-) Dave "Mike H" wrote: You were very close Private Sub Worksheet_Change(ByVal Target As Range) Select Case Target.Column Case Is = 3 MsgBox ("column" & Target.Column) Case Is = 4 MsgBox ("column" & Target.Column) Case Else 'Do something else End Select End Sub Mike "Risky Dave" wrote: Hi, From the worksheet code window, I am trying to identify when certain cells are modified and execute various functions according to different criteria. I am trying to do this by using a case statement based on the value of Target.Column, but nothing seems to be happening (no errors coming up, but not the result I was expecting either). I have: Private Sub Worksheet_Change(ByVal Target As Range) Select Case Target Case Target.Column = 3 MsgBox ("column" & Target.Column) Case Target.Column = 4 MsgBox("column" & Target.Column) End Select Obviously, in the final code, MsgBox willbe replaced by stuff that actually does useful things, but for now can someone tell me how to get this working, and if it won't how can I achieve this sort of result (it needs to be based on the column modified) TIA Dave |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
countif function: how to distinguish case/make case sensitive | Excel Worksheet Functions | |||
change data of entire column from small case to upper case | Excel Worksheet Functions | |||
Changing multiple cell text from lower case to upper case | Excel Discussion (Misc queries) | |||
Change the text from lower case to upper case in an Excel work boo | Excel Discussion (Misc queries) | |||
How do I change existing text from lower case to upper case | Excel Discussion (Misc queries) |