G
Geoff
I have a workbook with a combobox 'CUPrevious' on one of its worksheets, with
change event coded (in the worksheet module) as follows:
Private Sub CUPrevious_Change()
Dim t As String
Application.ScreenUpdating = False
If Application.EnableEvents Then
Application.EnableEvents = False
End If
t = CUPrevious.LinkedCell
If Range(t).Value <> "" Then
Call CUFunc(Range(t).Text)
End If
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
For some reason, whenever the workbook closes, this event is triggered and
if that sheet is not active at the time, the line
t = CUPrevious.LinkedCell
causes a runtime error as the value of linkedcell for the combobox seems to
be inaccessible. This is a problem which I have been able to get around by
calling the worksheet's Activate method in a Workbook.Before_Close procedure.
However, I don't see why the combobox change event should fire at all - the
value is not changing. Does anyone know why this is happening? More to the
point, is there some way to stop the event firing?
change event coded (in the worksheet module) as follows:
Private Sub CUPrevious_Change()
Dim t As String
Application.ScreenUpdating = False
If Application.EnableEvents Then
Application.EnableEvents = False
End If
t = CUPrevious.LinkedCell
If Range(t).Value <> "" Then
Call CUFunc(Range(t).Text)
End If
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
For some reason, whenever the workbook closes, this event is triggered and
if that sheet is not active at the time, the line
t = CUPrevious.LinkedCell
causes a runtime error as the value of linkedcell for the combobox seems to
be inaccessible. This is a problem which I have been able to get around by
calling the worksheet's Activate method in a Workbook.Before_Close procedure.
However, I don't see why the combobox change event should fire at all - the
value is not changing. Does anyone know why this is happening? More to the
point, is there some way to stop the event firing?