View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default UserForm Show Problem

fiorst comment out Userform1.show and replace with a=1 to make sure it it the
userform that has the problem. If the error doesn't occur then there is
something wrong with the target location.

Otherwise uncomment out the userform statement and put a break point using
F9 on the first line of every function in the userform. The first line is
the line with SUB like any onclick or initialize function.

The run the code. Keep on pressing F5 until the error occurs. the last
break point you reach will tell you which function is causing the error.

the start stepping through the last routine until you find the problem

One thing that may help find the problem quickly is to change the VBA errror
trapping. Go to VBA menu tools - OPtions - General - Error trapping. Change
setting to Trap on All errors. Also in finding problems like this I comment
out all ON Error statements. You may be bypassing an error and then casuing
a 2nd statement to fail. Yo can later add back the error trapping statment
after yo get the code working.


"K" wrote:

Hi all, I have code (see below) in sheet module

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)
If Not Application.Intersect(Range("D11:D12"), Target) Is Nothing Then
UserForm1.Show
End If
End Sub

when i double click on range D11 or D12 i get error message saying
" Run-time error '459':
Object or class does not support the set of events "

and when i click on debug then line "UserForm1.Show" gets higlighted.
It was working alright couple days ago but suddenly i start getting
this error. Please can any friend can help.