title: How to restrict VBA code to a specific worksheet?
body: <p>I am trying to restrict the macro to a specific the Test! worksheet When I activate the macro pasted below and I am within the Test! worksheet, the macro works. However, when I try activating the macro on a different sheet, I receive an error. Any idea on what I need to do to modify the VBA code in order for it to be work any other worksheet within the workbook? Thanks</p>
  
  <pre><code>Sub Test ()
  ' Test Macro
  '
  ' Keyboard Shortcut: Ctrl+Shift+B
  '
    Range ("Test!B1").Select 
    Selection.ClearContents
    Range ("Test!B2").Select
    Selection.ClearContents
    Range ("Test!B3").Select
    Selection.ClearContents
  End Sub
  </code></pre>