title: VBA Calling subroutine using If-Then - Goto
body: <pre><code>    Sub Testcopy()
  
      X = MsgBox("Press 1 to clear sheet or press 2 to copy")
  
          If X = 1 Then GoTo clearsheet
          If X = 2 Then GoTo Copysheet
  
          'MsgBox ("Incorrect entry")
      End Sub
  
      Sub clearsheet()
  
      sheetclearname = InputBox(" Enter the sheet you want to clear")
      Worksheets(sheetclearname).Select
      Worksheets(sheetclearname).UsedRange.Clear
      End Sub
  
  
      Sub Copysheet()
      Worksheets("Inputs").Activate
      Worksheets("Inputs").Range("Expenses").Copy
  
      Worksheets("Sheet3").Activate
       ActiveSheet.Range("A2").PasteSpecial Paste:=xlPasteValues
       ActiveSheet.Range("A2").PasteSpecial Paste:=xlPasteFormats
  
  
  End Sub
  </code></pre>
  
  <p>Guys</p>
  
  <p>I am trying to make a main routine which ask the user to enter option 1 or 2
  Option 1 takes to subroutine clearsheet and it clears the sheet chosen</p>
  
  <p>option 2 activates sub routine CopySheet and this copies from tab input range expenses to sheet 3</p>
  
  <p>when I run the macro I get label not defined</p>
  
  <ol>
  <li>What is label not defined here and how to make this works</li>
  </ol>
  
  <p>Thanks</p>