View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ian Wheaton Ian Wheaton is offline
external usenet poster
 
Posts: 1
Default Executing code in a library as a result of a worksheet change

I have a sub held in a module within a add in library (xla) called
calcForeign.

I want to execute this sub when a specific cell changes value. Heres my
code to spot the change on the worksheet

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$U$28" Then
Application.EnableEvents = False
'execute my sub
calcForeign

Application.EnableEvents = True
End If
End Sub

However excel will not find this sub - i get "compile error sub or
function not defined"

I can add a button to the sheet and assign the following macro
'C:\OrderIT\OrderITAddin.xla'!calcForeign
and it works OK

How do i reference a sub held in an xla Library?

Gratefull for any help

Regards

Ian