LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default intersect question

When I change the value in cell "f6" on the specific worksheet (first
worksheet with the code behind), normaly that value must change in several
cells in other worksheets (worksheets 2, 3 and 4), but when I check the other
worksheets, nothing has changed.

"Rick Rothstein" wrote:

Describe "doesn't work" for us.

--
Rick (MVP - Excel)


"Cheetahke" wrote in message
...
Hi Tom,

Thanks for the remarks. I had the right code in my worksheet, but mistyped
it here.
I've tried again, and it still doesn't work. I don't know what's wrong. Is
it possible that it's because I work with Excel 2003?

"Tom Hutchins" wrote:

You have clearly retyped some of your code in your post. The code you
submitted is missing a closing right parentheses each time after the
Intersect statement. This works for me:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
Set LastCellChanged = Target
If Not Intersect(LastCellChanged, Range("f6:f25")) Is Nothing Then
MsgBox "A"
Else
If Not Intersect(LastCellChanged, Range("h2")) Is Nothing Then
MsgBox "B"
Else
MsgBox "C"
End If
End If
End Sub

I assume you have some reason to assign Target to a range variable
LastCellChanged each time the event fires, instead of just using Target.

Since this is a worksheet event, it needs to be placed on the code module
for the particular worksheet where you want this to work, not in
ThisWorkbook
or a general VBA module.

Hope this helps,

Hutch

"Cheetahke" wrote:


Is it possible to use more than once the intersect methode? I tried
next
code, but it does not work. Any ideas?

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
Set LastCellChanged = Target
If not intersect(LastCellChanged, Range("f6:f25") is nothing then
'Do something
else
If not intersect(LastCellChanged, Range("h2") is nothing then
'Do something else
else
'Do 3rd thing
end if
end if

End Sub


.

 
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
intersect ranswert Excel Programming 12 February 6th 08 01:15 PM
Intersect Arne Hegefors Excel Programming 1 July 25th 06 09:38 AM
Intersect [email protected] Excel Programming 2 July 19th 06 10:41 PM
Intersect Formula??? scrabtree[_2_] Excel Programming 3 October 15th 03 08:30 PM
Help with If Not Intersect derek Excel Programming 6 July 11th 03 04:39 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"