ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pop up code not working (https://www.excelbanter.com/excel-programming/357802-pop-up-code-not-working.html)

Ian Manning

Pop up code not working
 
Hiya,

Wonder if anyone here could help me with a probelm I have getting a
calender control to pop up when a user clicks a cell. I have this
working in a test spreadsheet, but I can't get it to work as part of a
separate SS.

On the test spreadsheet I have used the following code in the worksheet
to pop up the active X control when the user clicks on cell B16:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$B$16" Then
Call OpenCalendar
End If
End Sub

Where OpenCalender is a function defined in the same module that has the
routing:

Sub OpenCalendar()
frmCalender.Show
End Sub

My problem is that although I can get the control to pop up in a test
spreadsheet, once I add it to my main spreadsheet it doesn't work.

Running the OpenCalendar function via the macros menu works fine. It
just doesn't appear when clicking cells.

THanks in advance if anyone can suggest anything.

--
Ian "tutenkamu" Manning
"The greatest thing the devil ever did, was convincing the world he
doesn't exist"
Kevin Spacey (Verbal Kint); The Usual Suspects

Tom Ogilvy

Pop up code not working
 
did you export the userform from your test workbook and import it into your
project (or otherwise create it there). Events are enabled in your
project workbook?

Obviously, if the code is working in one location, there wouldn't be much to
comment on concerning the code you show.

--
Regards,
Tom Ogilvy

"Ian Manning" wrote in message
...
Hiya,

Wonder if anyone here could help me with a probelm I have getting a
calender control to pop up when a user clicks a cell. I have this
working in a test spreadsheet, but I can't get it to work as part of a
separate SS.

On the test spreadsheet I have used the following code in the worksheet
to pop up the active X control when the user clicks on cell B16:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$B$16" Then
Call OpenCalendar
End If
End Sub

Where OpenCalender is a function defined in the same module that has the
routing:

Sub OpenCalendar()
frmCalender.Show
End Sub

My problem is that although I can get the control to pop up in a test
spreadsheet, once I add it to my main spreadsheet it doesn't work.

Running the OpenCalendar function via the macros menu works fine. It
just doesn't appear when clicking cells.

THanks in advance if anyone can suggest anything.

--
Ian "tutenkamu" Manning
"The greatest thing the devil ever did, was convincing the world he
doesn't exist"
Kevin Spacey (Verbal Kint); The Usual Suspects




Ian Manning

Pop up code not working
 
Tom Ogilvy wrote:
did you export the userform from your test workbook and import it into your
project (or otherwise create it there). Events are enabled in your
project workbook?

Obviously, if the code is working in one location, there wouldn't be much to
comment on concerning the code you show.

Thanks for replying.

I've tried both ways: exporting and creating it within it.

Using Application.EnableEvents = False I can at least now stop it from
working in my test workbook, however there is no =False statement in my
project. Is there anywhere else this setting can be found?

--
Ian "tutenkamu" Manning
"The greatest thing the devil ever did, was convincing the world he
doesn't exist"
Kevin Spacey (Verbal Kint); The Usual Suspects

Ian Manning

Pop up code not working
 
Ian Manning wrote:
Tom Ogilvy wrote:
did you export the userform from your test workbook and import it
into your
project (or otherwise create it there). Events are enabled in your
project workbook?

Obviously, if the code is working in one location, there wouldn't be
much to
comment on concerning the code you show.

Thanks for replying.

I've tried both ways: exporting and creating it within it.

Using Application.EnableEvents = False I can at least now stop it from
working in my test workbook, however there is no =False statement in my
project. Is there anywhere else this setting can be found?


Ahhh, I've worked out what is causing it: the cell referenced is
actually a merged cell....

--
Ian "tutenkamu" Manning
"The greatest trick the Devil ever pulled was convincing the world he
didn't exist."
Kevin Spacey (Verbal Kint); The Usual Suspects


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com