forcing to enter a specific format of numbers and symbols in a cell

sjoerdbosch

New Member
Joined
Mar 27, 2023
Messages
18
Office Version
  1. 365
Platform
  1. Windows
I am looking for a way - preferably hidden in the sheet as a macro - to force users to enter a specific format for latitude and longitude (2 different cells)
The format must be: 00-00.0 N/S - where the 1st 2 digits max 90 separated by - and then a max of 99 separated by . [not comma] and the last digit max 9 followed by a space and N/S should be a choice for North or South
The cell below the latitude is the longitude - 000-00.0 E/W - where the 1st 3 digits is max 180 followed by - and then again the same as latitude and the E/W is a choice for East or West

I have tried data entries and conditional formatting - and some silly macros - none of them work

Please help
 
My decimal setting is "." and I am testing with this.
How about yours? I guess ","?
Try to set into "." then test again?
 
Upvote 0

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
hi. sorry for late reply. Very busy at the moment
But - No. Really I have set excel to the proper settings for the separators and if I type the "," it is entered as 16-32,2 N and if I use the "." the cells is emptied and the box appears
I have tried several PC's and it is the same on all of them.
Really frustrating because as far I can see the macro is written correctly and you say it is working on your side. So, I do not know.

Maybe a separate macro for lat and for long ?
Also, N/S/E/W should be in upper case. I made a separate macro for that before but I have removed when entered your macro
Would be better if it inside the macro you wrote

Appreciated your attention and help btw
 
Upvote 0

Forum statistics

Threads
1,223,875
Messages
6,175,114
Members
452,613
Latest member
amorehouse

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top