title: Applescript service code to get value of a selected cell
body: <p>I state that I am not a programmer and I have no experience with applescript. I have a &quot;Numbers&quot; file with some data in the &quot;A&quot; column. I want to select a value by clicking on it and thought I would run an applescript service to assign the selected value to a global variable and write the value stored in another cell in the sheet.
  I found a similar script that seems to work in fact the value is stored in the variable but later the automator tells me that it cannot set the value read to the cell where I would like it to be compiled.</p>
  <pre><code>enter code here
  </code></pre>
  <p>on run {input, parameters}
  global mybox
  set mybox to 0</p>
  <pre><code>tell application &quot;Numbers&quot;
      tell the front document to ¬
          tell the active sheet to ¬
              set CurrentTable to the first table whose class of selection range is range
      tell the CurrentTable to get the value of the first cell in the selection range
      
      if the result is not missing value then set mybox to result
      display dialog &quot;Cell value: &quot; &amp; mybox
      set the value of cell &quot;b2&quot; to mybox
      
      
  end tell
  
  return input
  </code></pre>
  <p>end run</p>