Hi AJW,
Thanks for your code.
QuoteDisplay MoreOriginally posted by AJW
Anuja ??
WillR's answer is correct except that he has it working through the Workbook Open event.
From your Question I understand that you want it to work with a specific sheet selection ?? within a workbook.
If this is the case then use the following code as per attached example file.
Private Sub Worksheet_Activate()
On Error GoTo Error
Set Solv = AddIns("Solver Add-In")
If Solv.Installed = False Then
AddIns("Solver Add-in").Installed = True
End If
Exit Sub
Error:
Exit Sub
End Sub
Private Sub Worksheet_Deactivate()
On Error GoTo Error
Set Solv = AddIns("Solver Add-In")
If Solv.Installed = True Then
AddIns("Solver Add-in").Installed = False
'This shuts solver to conserve memory
Workbooks("Solver.XLA").Close SaveChanges:=False
End If
Exit Sub
Error:
Exit Sub
End Sub
Regards
AJW