View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Why is this Worksheet Change Event triggered?

OssieMac,

I agree with about the cause (trying to select a range on a sheet that isn't
active). But I don't see anything in the code that would change to a different
sheet.

So the problem (changing sheets) has to be in the FormatEscalationType
procedure.

Maybe it's just a case of defining what "the real problem" means.

I think you say that changing the activesheet is the real problem.

I was saying that the code inside FormatEscalationType is the real problem. I
just didn't offer any suggestion since the OP didn't share the code.

(Are we in violent agreement? A phrase we used at work when two people realized
that they were on the same side of an argument.)






OssieMac wrote:

I maybe should have explained my previous post a little better.
I dont agree with Daves comment €śsomething to do with that subroutine that
you didn't share€ť because I dont believe that is the real problem. I hope
Dave does not mind my disagreeing. However, I dont disagree with the code
Dave posted because it should overcome the problem.

I believe that the real reason for your problem needs explaining or you are
going to run into this problem again. It is the default sheet name with code
that is in the sheets module. The default sheet is the sheet that the code
belongs to and as Sheet2 is the ActiveSheet. Your code is attempting to
select a range on Sheet1 without first selecting Sheet1.

A good point of Daves is the GoTo. It selects the sheet as well as the
cell. However, the question is:
Do you want the code to Select the range on the ActiveSheet or on Sheet1.
If you want it to Select the active sheet then specify ActiveSheet as
follows:-

ActiveSheet.Range(sNextCell).Select

If you want it to select a range on Sheet1 then you can use either of the
following:-

'Sheet1 is default sheet and goto selects sheet and cell
Application.Goto Range(sNextCell)

Or
Sheets("Sheet1").Select
Range(sNextCell).Select

I hope it gives you a better understanding of what has occurred in your code.

--
Regards,

OssieMac



--

Dave Peterson