View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_7_] Bob Phillips[_7_] is offline
external usenet poster
 
Posts: 1,120
Default Newbie Confused...

I would suggest that you are. As I said, I would add application events to
your addin which would then apply to all worksheets, and remove the sheet
specific change event code.

I have knocked some code up which you put in the add-in Thisworkbook code
module, and it tests if cell H10 is a DV, if so it triggers, You can add you
form launch code in there.

Option Explicit

Public WithEvents App As Application

Private Const rngDV As String = "$H$10"

Private Sub Workbook_Open()
Set App = Application
End Sub

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Target.Address = rngDV Then
If Not Intersect(Target,
Cells.SpecialCells(xlCellTypeAllValidation)) Is Nothing Then
'do your stuff
End If
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
HTH

Bob Phillips

"ex1302" wrote in
message ...

You still need the forms and the Worksheet change code. We could do the
latter with application events, post the current code and we can
convert. I
assume the forms can be in the add-in? where will the DV list be?


Thanks for the reply, I had given up hope!


I have the forms and the macro to add the necessary DV list, and have
exported this as an addin...

lets say the user add's the "add-in" in to their brand new sheet, at
the moment nothing happens.... which i can understand... but how can i
get the DV list to initialise and somehow embed the code on to the sheet
to call the forms, or am i going about that the wrong way?

i.e at the moment the code for the form call (show) is on the
worksheet_change event, how could i get this to work from an add-in
perspective?

Thanks again :)


--
ex1302
------------------------------------------------------------------------
ex1302's Profile:

http://www.excelforum.com/member.php...o&userid=25217
View this thread: http://www.excelforum.com/showthread...hreadid=387079