View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
JimP JimP is offline
external usenet poster
 
Posts: 28
Default RunTime Error 424 in a USERFORM's code

To All,

Getting a runtime error # 424 on Closing of a USERFORM.
I'm trying to set a cell on the worksheet - which contains the
CmdButton that launched the UserForm. But my attempts to reference the
cell fail?

Could someone kindly instruct me how to set this up properly?

Thanks ...

JimP

'''''''''''''''''''''''''''''''
' TRIED TO DO THIS FIRST ....
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As
Integer)
If CloseMode < vbFormControlMenu Then
Cancel = False
' SYSTEM requested to close FORM, so set my flag!
[frmNAVIGATE_Run_flag].Value = 1 'PROBLEM ON THIS LINE
Else
Cancel = True: QuitButton_Click ' CANCEL QueryClose ... do what I
need
End If
End Sub

'''''''''''''''''''''''''''''''
' TRIED THIS SECOND ...
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As
Integer)
Dim ws As Worksheet: Set ws = Sheets(ActiveSheet.name)
If CloseMode < vbFormControlMenu Then
Cancel = False
' SYSTEM requested to close FORM, so set my flag!
ws.[frmNAVIGATE_Run_flag].Value = 1 'PROBLEM ON THIS LINE
Else
Cancel = True: QuitButton_Click ' CANCEL QueryClose ... do what I
need
End If
End Sub