With UTM converter you can easily convert UTM coordinates into Latitude and Longitude values. A Universal Transverse Mercator (UTM) coordinate is made up of a zone number, an easting, a northing and a hemisphere (N/S).
Download Now
If you want to start to use the software as soon as possible, then you can:
Otherwise, if you want to DIY, you can read the contents below.
Let’s Prepare the GUI
As shown in the image, leave top 4 rows of the excel sheet for holding Map Datum, Zone and Hemisphere. These 3 values will be used for all rows in the Excel sheet. At Row 5, starting from Column A, add these as headers
- DLS_KEY
- RM
- EASTING
- NORTHING
- LATITUDE
- LONGITUDE
Value on Columns A through Column D is input and the output i.e., Latitude and Longitude gets displayed on Columns E and F
Let’s make it functional
Copy the script into a new module and attach the macro to the button on the Sheet. Please make sure that your machine has Internet explorer. Without IE this script will not work.
Let’s test it
When you run the macro, you can easily track the status from the status bar of your Excel application. As we have manually induced some pause between each conversion, the macro will take the time to convert all your UTM coordinates into Lat and Long values. When all records are processed, you can see a Pop-Up message on the screen. If the macro is not able to save data on sheets, its might be because of corruption in your Excel file. Fix corrupt Excel file and run the script again.
Script:
Sub UTM_Converter() ' Place all your declarations here Dim i As Long Dim browobject As Object Dim obj1 As Object Dim obj2 As Object Set browobject = CreateObject("InternetExplorer.Application") browobject.Visible = False 'Process each row in the excle till the macro meets the last used row For r = 6 To 9 ' Navigate to the URL to process data browobject.navigate "http://www.rcn.montana.edu/resources/converter.aspx" ' Inform Users about the status Application.StatusBar = "Macro is converting data. Please wait... Now at Row : " & r & " /// Total Rows : " & Sheets("UTM to LAT LON").Range("C" & Rows.Count).End(xlUp).Row ' As this is dynamic, we have to wait for the browobject to process input and generate output Do While browobject.Busy Application.Wait DateAdd("s", 1, Now) Loop Application.Wait (Now() + TimeValue("00:00:02")) 'Lets populate the form browobject.document.getElementById("mapDatum").Value = "1" browobject.document.getElementById("utmZone").Value = "14" browobject.document.getElementById("utmHemi").Value = "N" 'utmEasting browobject.document.getElementById("utmEasting").Value = Sheets("UTM to LAT LON").Range("C" & r).Value 'utmNorthing browobject.document.getElementById("utmNorthing").Value = Sheets("UTM to LAT LON").Range("D" & r).Value Set obj2 = browobject.document.getElementsByTagName("input") v_length = 0 While v_length < obj2.Length If obj2(v_length).Value = "Convert Standard UTM" Then GoTo comehere End If v_length = v_length + 1 Wend comehere: obj2(v_length).Click ' Wait while browobject loading... Do While browobject.Busy Application.Wait DateAdd("s", 1, Now) Loop Application.Wait (Now() + TimeValue("00:00:02")) 'Show converted data on the sheet Sheets("UTM to LAT LON").Range("F" & r).Value = browobject.document.getElementById("decimalLongitude").Value Sheets("UTM to LAT LON").Range("E" & r).Value = browobject.document.getElementById("decimalLatitude").Value Next r ' Show browobject browobject.Visible = False browobject.Quit ' Clean up Set browobject = Nothing Set obj1 = Nothing Set obj2 = Nothing Application.StatusBar = "" 'Inform User that entire process was completed MsgBox "Converted !", vbInformation, "UTM to LAT LON converter v1.0" End Sub
Author Introduction:
Nick Vipond is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including repair doc file and outlook recovery software products. For more information visit www.datanumen.com