View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Doug[_9_] Doug[_9_] is offline
external usenet poster
 
Posts: 20
Default Message to Tom Ogilvy regarding SelectionChange

Tom,

Thanks again for the help with the SelectionChange code. One more follow up question if I may. Is this code legal:
----start code-------

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

if Target.Column = 1 then
if Target.Value < Target.offset(0,1).Value then
msgbox "Column 1"
end if
end if

if Target.Column = 5 then
if Target.Value < Target.offset(0,1).Value then
msgbox "Column 5"
end if
end if
End sub

-----end code-----

I have tried this, and only the first "if Target.Column = " statement seems to be recognized. If I run it this way, only targets in column 1 work. If I switch it around, then only targets in column 5 work. And I am not allowed to do more than one "Private Sub Worksheet_Change(ByVal Target As Excel.Range)" statement (I tried this and it told me ambiguous statement). What am I doing wrong? Thanks.

Doug