Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The question inside the body of your post (about the code) is completely different from the question in the title of your post.</p> <p>Now I'm going to answer the former very literally, with the caveat that this is a really bad way to do things. You're asking for something like this:</p> <pre><code>Sub distance() Dim i As Long For i = 0 To 1236 Range("D4:E4").Offset(i, 0).Copy Sheets("Analog Data").Select Range("F3:G3").Offset(i, 0).PasteSpecial Paste:=xlPasteValues, _ Operation:=xlNone, SkipBlanks:=False, Transpose:=False Range("D3:E3").Offset(i, 0).Select Application.CutCopyMode = False Selection.Copy Sheets("Cluster 58").Select Range("FT4").Offset(i, 0).Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Next i End Sub </code></pre> <p>Cleaning up this awful mess up a bit leads to this single statement, which does exactly the same thing as what your million-line code does:</p> <pre><code> Sheets("Analog Data").Range("F3:G3").Resize(1237, 2).Value _ = Sheets("Cluster 58").Range("D4:E4").Resize(1237, 2).Value </code></pre> <p>Now onto the lat-long thing. You're aware, I presume, that with (lat,long) given in degrees, points (0,0) and (0,0.1) are roughly 10 km apart, while points (90,-131) and (90,74) are exactly 0 km apart? This is assuming a spherical Earth. Assuming a more realistic datum e.g. <a href="http://en.wikipedia.org/wiki/WGS84" rel="nofollow">WGS84</a> leads to more complicated distance calculations. </p> <p>Before asking how to do this in Excel, you should ask yourself (and tell us) how you would do this on a piece of paper. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload