Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Problem w/ worksheet change event

Thanks Jim. I added the error handler that you mentioned in your first
post, and that took care of both problems. The code no longer throws an
error when both cells are cleared, which in turn (I suppose) does not cause
the enableevents to go to false. Thanks so much for your help!

"Jim Thomlinson" wrote in message
...
As for the .Value throwing an error. I am assuming that you have "With
Target"... The problem is that target is a range, not a single cell. What

you
can do is to traverse through all of the cells in the target and check if

it
is within the range you have defined and then do the voodo you want to do.
Since I have seen your coding and I know you have a reasonable ability to

do
this kind of thing I will give you some general instructions. What you

want
to do is to check the intersection of the target with the the range set

out
in your if statement. I recomend creating a range object for this

Dim rng as range
dim rngCurrent as range

On error resume next
set rng = intersect(Target, range("E12", "E311"))
on error goto errorhandler
if not rng is nothing then
for each rngCurrent in rng

next rngCurrent
--
HTH...

Jim Thomlinson


"Steph" wrote:

Hi all. I have the following inside a worksheet change event:
'Lock/Unlock cells based on FT/PT status
If .Column = 5 And .Row 11 And .Row < 312 Then
Application.EnableEvents = False
If .Value = "PT" Then
Cells(.Row, 6).Value = 20
Else
Cells(.Row, 6).Value = 40
End If
Application.EnableEvents = True
End If

I the user highlights and clears contents of column 5 and 6 at the same

time
(ie E5:F5), I get a type mismatch error on the line If .Value = "PT"

Then,
and the change event won't fire unless I completely clode out of excel

and
re-open. Any ideas on how to prevent that from happening?





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
Worksheet Change Event Problem tim Excel Programming 9 March 28th 05 08:37 AM
Worksheet Row Change event crazybass2 Excel Discussion (Misc queries) 4 December 8th 04 05:29 PM
Worksheet Change event Libby Excel Programming 2 October 26th 04 12:02 AM
Change Cell from Validated List Not Firing Worksheet Change Event [email protected] Excel Programming 3 October 4th 04 03:00 AM


All times are GMT +1. The time now is 12:24 PM.

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"