+ Reply to Thread
Results 1 to 2 of 2

Macro to change coordinates from DD to DMS

  1. #1
    Registered User
    Join Date
    03-07-2018
    Location
    France
    MS-Off Ver
    Excel 2016
    Posts
    1

    Macro to change coordinates from DD to DMS

    Hi,

    I have a file with one column that contains coordinates in decimal degrees.
    I first want to split my column into two with the simple " " (space) separator
    and then I want to apply this macro

    Sub ConvertDegree()
    'Update 20130815
    Dim Rng As Range
    Dim WorkRng As Range
    On Error Resume Next
    xTitleId = "KutoolsforExcel"
    Set WorkRng = Application.Selection
    Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
    For Each Rng In WorkRng
    num1 = Rng.Value
    num2 = (num1 - Int(num1)) * 60
    num3 = Format((num2 - Int(num2)) * 60, "00")
    Rng.Value = Int(num1) & "°" & Int(num2) & "'" & Int(num3) & "''"
    Next
    End Sub



    I just dont know how to combine the two if anyone could help me that would be amazing.

    Thank you

  2. #2
    Registered User
    Join Date
    03-07-2018
    Location
    Zürich
    MS-Off Ver
    Office 2010
    Posts
    2

    Re: Macro to change coordinates from DD to DMS

    Hey there,

    I dont know if I understand everything correctly.
    - The coordinates are only seperated by " "(space)? Example: (7.187345 9.247461)
    - You want to split it in to separete cells? Example: A1 = 7.187345 / B1 = 9.247461

    If this is correct, the following should work

    Please Login or Register  to view this content.
    .

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 9
    Last Post: 11-12-2017, 10:38 PM
  2. Use a macro to get x and y coordinates of graph
    By badeend in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-23-2017, 06:20 AM
  3. How do I get line coordinates assigned to variables in this macro
    By levins1951 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-06-2017, 06:32 PM
  4. change the size of triangle but its reamins its coordinates
    By riz4u in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-09-2016, 02:06 AM
  5. Generate a macro that changes to new cell coordinates every time it runs
    By neima in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-19-2014, 11:21 AM
  6. Macro to filter map coordinates
    By glide2131 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-16-2013, 07:35 PM
  7. Convert point coordinates -> pixel coordinates
    By Zorro in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-31-2006, 10:30 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1