View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel
ShaneDevenshire ShaneDevenshire is offline
external usenet poster
 
Posts: 2,344
Default userform commnad from a sheet command

Hi,

We would generally not use a branch for this (Go To Line) more likely

If x = "Y" then
FirstSub
Else
SecondSub
End If

Where FirstSub is the name of a separate subroutine and SecondSub another
name.
But if you must use the method you mentions

If x="Y" then
Go To MyLine
End if


MyLine: (this is a line number in excel)
your code here

--
Thanks,
Shane Devenshire


"teepee" wrote:

Hello

I have the following piece of code in Excel sheet 1 to trigger an event when
a cell content changes

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$4" Then
'This Code Runs When Cell A4 Changes'
End If
End Sub

What I want to do is insert here code to interrupt the running of a
particular userform and goto a particular point and resume that same
userform.

So something like

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$4" Then
userform1.stop
goto userform 1line 220
userform1.resume
End If
End Sub

Except obviously I'm making up the code here. Could anyone advise on what
the correct code might be for such an operation.

Many thanks