stirlingmw
Board Regular
- Joined
- Feb 18, 2013
- Messages
- 75
Morning all
I am having trouble with 2 formulas that calculate range and bearing from latitudes and longitudes. Currently I have the formula in 2 cells on sheet1 (L38 - Range), L39 - Bearing).
L38 = IFERROR(distvincenty(signit(K26),signit(K27),signit(K33),signit(K34)),"--")
L39 = IFERROR(MROUND(MOD(DEGREES(ATAN2(COS(signit(K26)*PI()/180)*SIN(signit(K33)*PI()/180)-SIN(signit(K26)*PI()/180)*COS(signit(K33)*PI()/180)*COS(signit(K34)*PI()/180-signit(K27)*PI()/180),SIN(signit(K34)*PI()/180-signit(K27)*PI()/180)*COS(signit(K26)*PI()/180)))+360,360),1),"--")
K26 - Latitude 1, K27 Longitude 1, K33 - Latitude - 2 and K34 - Longitude 2
distvincenty - Public Function
signit - Function
ATAN2 - Public Function
The issue I am having is that to get these 2 formulas to function I have to unprotect the worksheet click into the formula, select a cell reference and then press return. I have to do this for both formula. Is there any way I can write these formula into a vba worksheet change function. Other people use this workbook and I need to have it password protected, but still need to the function to work.
thanks
Steve
I am having trouble with 2 formulas that calculate range and bearing from latitudes and longitudes. Currently I have the formula in 2 cells on sheet1 (L38 - Range), L39 - Bearing).
L38 = IFERROR(distvincenty(signit(K26),signit(K27),signit(K33),signit(K34)),"--")
L39 = IFERROR(MROUND(MOD(DEGREES(ATAN2(COS(signit(K26)*PI()/180)*SIN(signit(K33)*PI()/180)-SIN(signit(K26)*PI()/180)*COS(signit(K33)*PI()/180)*COS(signit(K34)*PI()/180-signit(K27)*PI()/180),SIN(signit(K34)*PI()/180-signit(K27)*PI()/180)*COS(signit(K26)*PI()/180)))+360,360),1),"--")
K26 - Latitude 1, K27 Longitude 1, K33 - Latitude - 2 and K34 - Longitude 2
distvincenty - Public Function
signit - Function
ATAN2 - Public Function
The issue I am having is that to get these 2 formulas to function I have to unprotect the worksheet click into the formula, select a cell reference and then press return. I have to do this for both formula. Is there any way I can write these formula into a vba worksheet change function. Other people use this workbook and I need to have it password protected, but still need to the function to work.
thanks
Steve