Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Message to Tom Ogilvy regarding SelectionChange

Never mind. It now appears to be working fine. Go figure

Doug
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Message to Tom Ogilvy regarding SelectionChange

Yes, it is legal. Since it is the change event, it only fires when you edit
a cell - not just select it as was the case when you used selectionChange.
But based on your description, Change sounded like the more appropriate
event.

--
Regards,
Tom Ogilvy



Doug wrote in message
...
Never mind. It now appears to be working fine. Go figure.

Doug



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
Tom Ogilvy Denny Crane Excel Worksheet Functions 2 March 15th 06 08:41 PM
Thank You Tom Ogilvy Brian Excel Worksheet Functions 0 December 16th 04 02:47 AM
Tom Ogilvy:Object Error Still Rhonda[_3_] Excel Programming 0 December 10th 03 02:53 PM
to Tom Ogilvy: re Macros in excel Tom Ogilvy Excel Programming 0 August 18th 03 07:47 PM
SelectionChange code always available René Excel Programming 0 July 13th 03 01:46 PM


All times are GMT +1. The time now is 08:40 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"