Sub logbooktypingchecker() 'Spreadsheet Typing Checker for Logbook Transcribers 'Programmer: James Ostiguy 'This version was completed: Aug. 16, 2012 'Last change: Sept. 11, 2012 'This routine evaluates up to 5000 plate entries for the following: '1. Compares (Start Time - R.A) with H.A. and reports the difference. '2. Determines that the R.A., Dec., H.A., Start, and Stop values are all within their respective ranges. '3. Checks for Start and Stop times being out of sequence. '4. Checks that the duration of the exposure is less than a maximum value. '5. Determines if the plate coordinates are below the horizon during the exposure. '6. When necessary, converts the time type to sidereal time by reading 'the time type entered in column N and writing the converted times to columns O and P. '7. Offers the option to display altitude angles for the Start and Stop times in columns Q and R. 'This routine only writes to columns L through R. 'All the information in these columns except the time type will be deleted after you have finished correcting 'any typing errors and noting any significant problems in the logbook data. converttime = "" If (Range("L1").Value <> "Error in R.A., H.A., or Start") Then 'Display information about this program extrafetures = "6. When necessary, converts the time type to sidereal time by reading the time type" & Chr(13) & "entered in column N and writing the converted times to columns O and P." & Chr(13) & "7. Offers the option to display altitude angles for the Start and Stop times in columns Q and R." extraline = "This routine only writes to columns L through R." & Chr(13) & Chr(13) & "Times recorded in most logbooks are in sidereal time. Some logbooks used standard time or GMT." & Chr(13) & "Are time types other than sidereal time used in the logbook?" Message = MsgBox("Programmer: James Ostiguy" & Chr(13) & "This version was completed on Aug. 16, 2012" & Chr(13) & "Last change was made on Sept. 11, 2012" & Chr(13) & Chr(13) & "This routine evaluates up to 5000 plate entries for the following:" & Chr(13) & "1. Compares (Start Time - R.A) with the Hour Angle and reports the difference." & Chr(13) & "2. Determines that the R.A., Dec., H.A., Start, and Stop values are all within their respective ranges." & Chr(13) & "3. Checks for Start and Stop times being out of sequence." & Chr(13) & "4. Checks for unusually long exposures." & Chr(13) & "5. Determines if the plate coordinates are below the horizon during the exposure." & Chr(13) & extrafetures & Chr(13) & Chr(13) & extraline, 3, "Spreadsheet Typing Checker for Logbook Transcribers") If (Message = 2) Then End If (Message = 6) Then converttime = "yes" 'Determine Observation Location Location = InputBox("Enter the number corresponding to the" & Chr(13) & "observer location for the logbook." & Chr(13) & Chr(13) & " 1 Cambridge MA" & Chr(13) & " 2 Oak Ridge" & Chr(13) & " 3 Norwell MA" & Chr(13) & " 4 Taunton MA" & Chr(13) & " 5 Ossipee, NH" & Chr(13) & " 6 Arequipa" & Chr(13) & " 7 Bloemfontein" & Chr(13) & " 8 Mt. Harvard, Peru" & Chr(13) & " 9 San Jose, Peru" & Chr(13) & " 10 Willows, CA" & Chr(13) & " 11 Wilsons Peak, CA" & Chr(13) & "12 Jamaica" & Chr(13) & "13 McDonald Observatory" & Chr(13) & "14 Hanover, S. Africa" & Chr(13) & "15 Chuquicamata, Ch" & Chr(13) & "16 El Leoncito, Argentina" & Chr(13) & "17 CTIO" & Chr(13) & "18 Mt. John, NZ", "Location Selecter", 1) If (Message = 6 Or Message = 7) Then Range("M1").Value = "Other Messages for Loc. " & Location 'Set Column Widths 'Columns("K:K").ColumnWidth = 38 Columns("L:M").ColumnWidth = 23 If (converttime = "yes") Then Range("N1").Value = "Time Type pre" 'Display information on time conversions and altitude angles. showalt = MsgBox("If this logbook has start times in standard time, daylight savings time, or GMT, then using capital letters" & Chr(13) & "type the abbreviation for the time zone in column N to see local sidereal times in columns O and P." & Chr(13) & Chr(13) & "Do you want altitude angles for the Start and Stop times displayed in columns P and Q?", 4 + 256, "Information for Time Type Conversion") 'Set Column Widths Columns("N:N").ColumnWidth = 9.14 Columns("O:P").ColumnWidth = 14 'Store Values If (showalt = 6) Then Range("Q1").Value = "Alt. Ang. at Start": Range("R1").Value = "Alt. Ang. at Stop": Columns("Q:R").ColumnWidth = 14 Range("O1").Value = "Converted Start" Range("P1").Value = "Converted Stop" End If End If 'Establish the coordinates and time zone of the observation location. Location = Trim(Right(Trim(Range("M1").Value), 2)) If (Location = 1) Then Lat = 42.38: lon = -71.1292: timezone = -5 'Cambridge MA If (Location = 2) Then Lat = 42.5033: lon = -71.5583: timezone = -5 'Oak Ridge If (Location = 3) Then Lat = 42.0538: lon = -70.7944: timezone = -5 'Norwell If (Location = 4) Then Lat = 41.8997: lon = -71.0903: timezone = -5 'Taunton If (Location = 5) Then Lat = 43.685341: lon = -71.116789: timezone = -5 'Ossipee, NH If (Location = 6) Then Lat = -16.375: lon = -71.55: timezone = -5 'Arequipa If (Location = 7) Then Lat = -29.0383: lon = 26.4042: timezone = 2 'Bloemfontein If (Location = 8) Then Lat = -11.8756: lon = -76.7036: timezone = -5 'Mt. Harvard, Peru If (Location = 9) Then Lat = -6.7297: lon = -79.84: timezone = -5 'San Jose, Peru If (Location = 10) Then Lat = 39.525: lon = -122.1941: timezone = -8 'Willows, CA If (Location = 11) Then Lat = 34.2153: lon = -118.0596: timezone = -8 'Wilsons Peak, CA If (Location = 12) Then Lat = 18: lon = -77: timezone = -5 'Jamaica If (Location = 13) Then Lat = 30.67164: lon = -104.02304: timezone = -7 'McDonald Observatory If (Location = 14) Then Lat = -25: lon = 30: timezone = 2 'Hanover, S. Africa If (Location = 15) Then Lat = -22.315: lon = -68.9292: timezone = -4 'Chuquicamata, Ch If (Location = 16) Then Lat = -30: lon = -67: timezone = -3 'El Leoncito, Argentina If (Location = 17) Then Lat = -30.1683: lon = -70.8042: timezone = -4 'CTIO If (Location = 18) Then Lat = -43.9867: lon = 170.4666: timezone = 12 'Mt. John, NZ 'Label Headings 'Range("I1").Value = "Exposure" 'Range("I2").Value = "minutes" Range("L1").Value = "Error in R.A., H.A., or Start" 'Set Variables to initial values Dim mth(12) As Integer MaxExpDur = 2.2 'max exposure time allowed without warning, in hours Count = 5000 'maximum number of plates If (Location = "") Then Lat = 42.4 'Approximate latitude of Cambridge, MA. AltL = 10 'Lowest viewing angle above horizon allowed without a warning, in degrees." pie = 3.1415926 prevtstop = 0 maxerror = 1 lastdate = Trim(Range("J2").Value) precescor = Trim(Right(Trim(Range("N1").Value), 3)) startcount = 2 If (Trim(Range("A2").Value) <> 2) Then lastdate = Trim(Range("J3").Value): startcount = 3 For e = startcount To Count 'Create cell pointers Be = "B" & e 'Plate number De = "D" & e 'R.A. Ee = "E" & e 'Dec. Ge = "G" & e 'H.A. Fe = "F" & e 'Start Time He = "H" & e 'Stop Time Ie = "I" & e 'Duration of Exposure Je = "J" & e 'Date Ke = "K" & e 'Comments Le = "L" & e 'R.A., H.A., or Start Time Errors Me1 = "M" & e 'Other Errors Ne = "N" & e 'Time Type Oe = "O" & e 'Converted Start Time Pe = "P" & e 'Converted Stop Time Qe = "Q" & e 'Altitude Angle at Start Re = "R" & e 'Altitude Angle at Stop Se = "S" & e If (Range(Be).Value = "" And Range(Fe).Value = "") Then Range(Le).Value = "End": Range(Me1).Value = e - startcount & " rows checked": Exit For 'End if no plate number and no start time. 'Check for Start value. If (Range(Fe).Value = "") Then note = "missing Start " Else 'Read Start Time Sts = 0 Ststring = Trim(Range(Fe).Value) & " " Stlength = Len(Ststring) pos = InStr(Ststring, " ") If (pos = Stlength) Then noteM = noteM & "Check Start Time " Else sth = Trim(Left(Ststring, pos)) Stmstring = Trim(Mid(Ststring, pos)) & " " Stmlength = Len(Stmstring) pos = InStr(Stmstring, " ") If (pos = Stmlength) Then stm = Trim(Stmstring) Else stm = Trim(Left(Stmstring, pos)) Stsstring = Trim(Mid(Stmstring, pos)) Sts = Val(Stsstring) End If stm = Val(stm) + Sts / 60 tstart = Val(sth) + Val(stm) / 60 If (tstart >= 24) Then noteM = "check start time " & noteM If (stm >= 60) Then noteM = "check start time " & noteM End If End If 'Range(Re).Value = sth & " " & stm 'Check for Stop value. If (Range(He).Value = "") Then note = note & "missing Stop" Else 'Read Stop Time Sps = 0 Spstring = Trim(Range(He).Value) & " " Splength = Len(Spstring) pos = InStr(Spstring, " ") If (pos = Splength) Then noteM = noteM & "Check Stop Time " Else Sph = Trim(Left(Spstring, pos)) Spmstring = Trim(Mid(Spstring, pos)) & " " Spmlength = Len(Spmstring) pos = InStr(Spmstring, " ") If (pos = Spmlength) Then Spm = Trim(Spmstring) Else Spm = Trim(Left(Spmstring, pos)) Spsstring = Trim(Mid(Spmstring, pos)) Sps = Val(Spsstring) End If Spm = Val(Spm) + Sps / 60 tstop = Val(Sph) + Val(Spm) / 60 If (tstop >= 24) Then noteM = "check stop time " & noteM If (Val(Spm) >= 60) Then noteM = "check stop time " & noteM End If End If 'Read Date daystring2 = "" 'clear second date pagedate = Trim(Range(Je).Value) If (pagedate = "") Then pagedate = lastdate: noteM = noteM & "Missing Page Date" pos = InStr(pagedate, " ") If (pos = 0) Then noteM = noteM & "Check Date " Datecondition = "unusable" Else monthstring = Trim(Left(pagedate, pos)) yearstring = Trim(Right(pagedate, 4)) posd = InStr(pagedate, "-") If (posd = 0) Then datestring = Trim(Mid(pagedate, pos)) pos = InStr(datestring, " ") posc = InStr(datestring, ",") If (pos = 0 And posc = 0) Then noteM = noteM & "Check Date " Datecondition = "unusable" Else If (posc = 0) Then daystring = Trim(Left(datestring, pos)) Else daystring = Trim(Left(datestring, posc - 1)) If (pos = 0) Then noteM = noteM & "Check Date " End If Datecondition = "usable" End If Else monthdaystring = Trim(Left(pagedate, posd - 1)) pos = InStr(monthdaystring, " ") If (pos = 0) Then noteM = noteM & "Check Date " Datecondition = "unusable" Else daystring = Trim(Mid(monthdaystring, pos)) Datecondition = "usable" End If dayyearstring = Trim(Mid(pagedate, posd + 1)) pos = InStr(dayyearstring, " ") If (pos = 0) Then noteM = noteM & "Check Date " Datecondition = "unusable" Else daystring2 = Trim(Left(dayyearstring, pos)) Datecondition = "usable" End If End If End If yr = Val(yearstring) dy = Val(daystring) dy2 = Val(daystring2) platedate = monthstring & " " & dy & ", " & yr mn = Val(Month(platedate)) 'Compare Start and Stop Times tstop = Val(Sph) + Val(Spm) / 60 tstart = Val(sth) + Val(stm) / 60 expduration = Trim(Range(Ie).Value) 'Range("S" & e).Value = expduration If (expduration = "") Then 'Check for Start and Stop times being out of sequence If (pagedate = lastdate) Then If (prevtstop > 12 And tstart < 12) Then setuptime = 24 + tstart - prevtstop Else setuptime = tstart - prevtstop Else: setuptime = 0 End If If (tstart - tstop > 24 - MaxExpDur) Then exposuretime = 24 + tstop - tstart Else exposuretime = tstop - tstart If (setuptime < 0) Then noteM = "duration overlap " & noteM 'Compare the Duration of Exposure with the maximum value. If (exposuretime > MaxExpDur) Then noteM = noteM & "extra long exposure " Else difference = (Val(Sph) - Val(sth)) * 60 + Round(Spm - stm) If (tstart - tstop > 0) Then difference = difference + 24 * 60 If (Abs(difference - Val(expduration)) > 1) Then noteM = noteM & "Check Exposure, Start, & Stop " End If 'Set value for next plate data test. prevtstop = tstop If (Datecondition = "usable") Then 'Convert Time Type timecode = Trim(Range(Ne).Value) 'timecode = InStr(timecode, "ST", 1) If (timecode = "") Then timetype = "" Else timetype = Left(timecode, 2) If (timetype = "UT" Or timecode = "GMT") Then timetype = "UT" Else timetype = Right(timecode, 2) If (timetype = "ST") Then Else If (timetype <> "DT") Then noteM = "Check Time Type " & noteM End If End If End If If (timetype = "ST" Or timetype = "DT" Or timetype = "UT") Then maxerror = 7 'Increase maxerror for ST, DT, and UT time types. 'Start Time yearinepoch = yr - 2000: CIGST = 18.69737: leepday = 0 'If (yr < 1976) Then yearinepoch = yr - 1950: CIGST = (0.923459) * 24: If (yr > 1950) Then leepday = 1 'If (yr < 1926) Then yearinepoch = yr - 1900: leepday = 0: CIGST = (0.81352-.175) * 24 mth(1) = 0: mth(2) = 31: mth(3) = 59: mth(4) = 90: mth(5) = 120: mth(6) = 151: mth(7) = 181: mth(8) = 212: mth(9) = 243: mth(10) = 273: mth(11) = 304: mth(12) = 334 If (yearinepoch / 4 = yearinepoch \ 4) Then If (yearinepoch > 0 And mn < 3) Then leepday = leepday - 1 If (yearinepoch < 0 And mn > 2) Then leepday = leepday + 1 End If 'Correct for the change of date during the observing session. If (lastdate = pagedate) Then If (begintime > tstart) Then dy = dy + 1 ': Range(Qe).Value = Range(Qe).Value & " + 1 " Else begintime = tstart End If If (daystring2 = "") Then Else If (timetype = "ST" Or timetype = "DT") Then If (tstart < 12) Then dy = dy2 ': Range(Qe).Value = Range(Qe).Value & dy End If 'Calculate days since epoch date days = yearinepoch * 365 + yearinepoch \ 4 + mth(mn) + dy - 1 + (Val(sth) + stm / 60) / 24 + leepday 'Set time zone offset If (timetype = "ST") Then hoffset = timezone If (timetype = "DT") Then hoffset = timezone + 1 If (timetype = "UT") Then hoffset = 0 'Calculate the sidereal start time. siddays = (days - hoffset / 24 - 0.5) * 1.00273790935 + lon / 360 + CIGST / 24 sidtime = (siddays - Int(siddays)) * 24 sidh = Int(sidtime): sidm = Int((sidtime - sidh) * 60000) / 1000 sth = sidh: stm = sidm obststart = tstart tstart = Val(sth) + Val(stm) / 60 Range(Oe).Value = sidh & "h " & sidm & "m" stdays = days 'Stop Time obststop = tstop 'Calculate days since epoch date days = yearinepoch * 365 + yearinepoch \ 4 + mth(mn) + dy - 1 + (Val(Sph) + Spm / 60) / 24 + leepday 'Correct for the change of date durring the observing session. If (obststart > tstop) Then days = days + 1 ': Range(Qe).Value = Range(Qe).Value & " + p1 " 'Set time zone offset If (timetype = "ST") Then hoffset = timezone ': If (Val(Sph) < 12) Then days = days + 1 If (timetype = "DT") Then hoffset = timezone + 1 ': If (Val(Sph) < 12) Then days = days + 1 If (timetype = "UT") Then hoffset = 0 'Calculate the sidereal stop time. siddays = (days - hoffset / 24 - 0.5) * 1.00273790935 + lon / 360 + CIGST / 24 sidtime = (siddays - Int(siddays)) * 24 sidh = Int(sidtime): sidm = Int((sidtime - sidh) * 60000) / 1000 Range(Pe).Value = sidh & "h " & sidm & "m" Sph = sidh: Spm = sidm tstop = Val(Sph) + Val(Spm) / 60 Else Range(Oe).Value = "" Range(Pe).Value = "" End If Else Range(Oe).Value = "Unusable Date" End If If (Range(Be).Value <> "" And Range(Be).Value <> " ") Then 'Skip to printing error messages if no plate number. 'Read Dec. dec = Trim(Range(Ee).Value) VDec = Val(dec) If (Val(dec) > 90 Or Val(dec) < ILat - 90) Then noteM = "check Dec. " & noteM 'Check for H.A. value. If (Range(Ge).Value = "") Then note = note & "missing H.A." HAh = 0 HAm = 0 eorw = "0" Else 'Read H.A. HAs = 0 HAstring = Trim(Range(Ge).Value) eorw = Right(HAstring, 1) pn = Left(HAstring, 1) If (pn = "-") Then pn = -1 Else pn = 1 If (Val(eorw) >= 0 And Val(eorw) < 10) Then HAlength = Len(HAstring) Else HAlength = Len(HAstring) - 1 End If HAstring = Trim(Left(HAstring, HAlength)) & " " pos = InStr(HAstring, " ") If (pos = HAlength) Then noteM = "Check H.A. " & noteM Else HAh = Trim(Left(HAstring, pos)) HAmstring = Trim(Mid(HAstring, pos)) & " " HAmlength = Len(HAmstring) pos = InStr(HAmstring, " ") If (pos = HAmlength) Then HAm = Trim(HAmstring) Else HAm = Trim(Left(HAmstring, pos)) HAsstring = Trim(Mid(HAmstring, pos)) HAs = Val(HAsstring) End If HAh = Val(HAh) HAm = Val(HAm) + HAs / 60 End If End If 'Determine the sign of the H.A. value. EW = 0 If (eorw = "w" Or eorw = "W") Then HAHr = HAh HAMn = HAm EW = -1 End If If (eorw = "e" Or eorw = "E") Then HAHr = -HAh HAMn = -HAm EW = 1 End If If (EW = 0) Then If (HAh <> 0 Or HAm <> 0) Then noteM = noteM & "check HA " 'Error if no direction is indicated HAHr = HAh HAMn = pn * HAm End If VHA = HAh + HAm / 60 If (VHA > 12) Then noteM = "check HA " & noteM If (HAm >= 60) Then noteM = "check HA " & noteM 'Range(Re).Value = HAHr & " " & HAMn 'Check for R.A. value. If (Range(De).Value = "") Then If (dec < 90) Then note = note & "missing R.A." RAcondition = "unusable" Else 'Read R.A. RAs = 0 RAstring = Trim(Range(De).Value) & " " RAlength = Len(RAstring) pos = InStr(RAstring, " ") If (pos = RAlength) Then note = note & "Check R.A." RAcondition = "unusable" Else RAh = Val(Trim(Left(RAstring, pos))) RAmstring = Trim(Mid(RAstring, pos)) & " " RAmlength = Len(RAmstring) pos = InStr(RAmstring, " ") If (pos = RAmlength) Then RAm = Val(Trim(RAmstring)) Else RAm = Val(Trim(Left(RAstring, pos))) RAsstring = Trim(Mid(RAmstring, pos)) RAs = Val(Trim(RAsstring)) End If RAm = RAm + RAs / 60 VRA = Val(RAh) + Val(RAm) / 60 RAcondition = "usable" If (VRA >= 24) Then note = "check RA " & note If (Val(RAm) >= 60) Then noteM = "check RA " & note End If 'Approx. Precession correction If (timetype = "") Then Else If (precescor = "pre") Then 'Don't Bypass Precession correction If (yr < 2026) Then epochdays = stdays If (yr < 1970) Then epochdays = stdays + 50 * 365 + 12 If (yr < 1926) Then epochdays = stdays + 100 * 365 + 24 prec = 50.249 * epochdays / 365.25 * pie / 3600 / 180 axisprec = prec * Cos(23.44 * pie / 180) decr = VDec * pie / 180 VRAr = VRA * pie / 12 x1 = Sin(decr) * Sin(axisprec) * Cos(23.44 * pie / 180) + Cos(decr) * Cos(VRAr) * Cos(axisprec) adjRAr = Atn((Cos(decr) * Sin(VRAr)) / x1) If (x1 < 0) Then adjRAr = adjRAr + pie If (Location = 18) Then prec = 0 'RA1r = VRAr - prec RA1r = adjRAr - prec RA1 = RA1r * 12 / pie RA1h = Int(RA1) RA1m = (RA1 - RA1h) * 60 RAh = RA1h: RAm = RA1m: RAs = 0 'Range(Re).Value = prec * 180 * 60 / pie / 15 'Range(Re).Value = (RA1r - VRAr) * 180 * 60 / pie / 15 End If 'End Bypass Precession correction End If If (RAcondition = "usable") Then 'Compare (Start Time - RA) with HA hc = 0 m = (stm - RAm) - HAMn 'Range(Re).Value = m If (m >= 60) Then m = m - 60: hc = 1 If (m < 0) Then m = m + 60: hc = -1 m = Round(m) h = (Val(sth) - Val(RAh)) - HAHr + hc 'Range(Re).Value = h & " " & m 'Compute for -HA also to check "e vs. w" error. hc1 = 0 m1 = (stm - RAm) + HAMn 'Range(Se).Value = m1 If (m1 >= 60) Then m1 = m1 - 60: hc1 = 1 If (m1 < 0) Then m1 = m1 + 60: hc1 = -1 m1 = Round(m1) h1 = (Val(sth) - Val(RAh)) + HAHr + hc1 'Range(Se).Value = h1 & " " & m1 'Normalize hour and minute values. If (h > 0 And m < 0) Then h = h - 1: m = m + 60 If (h < 0 And m > 0) Then h = h + 1: m = m - 60 If (m >= 60) Then h = h + 1: m = m - 60 If (m <= -60) Then h = h - 1: m = m + 60 If (h >= 24) Then h = h - 24 If (h <= -24) Then h = h + 24 If (h > 18) Then If (m = 0) Then h = h - 24 Else m = m - 60: h = h - 23 If (h <= -18) Then If (m = 0) Then h = h + 24 Else m = m + 60: h = h + 23 'Range(Re).Value = h & " " & m & " " & hc 'Compute for -HA also to check "e vs. w" error. If (h1 > 0 And m1 < 0) Then h1 = h1 - 1: m1 = m1 + 60 If (h1 < 0 And m1 > 0) Then h1 = h1 + 1: m1 = m1 - 60 If (m1 >= 60) Then h1 = h1 + 1: m1 = m1 - 60 If (m1 <= -60) Then h1 = h1 - 1: m1 = m1 + 60 If (h1 >= 24) Then h1 = h1 - 24 If (h1 <= -24) Then h1 = h1 + 24 If (h1 > 18) Then If (m1 = 0) Then h1 = h1 - 24 Else m1 = m1 - 60: h1 = h1 - 23 If (h1 <= -18) Then If (m1 = 0) Then h1 = h1 + 24 Else m1 = m1 + 60: h1 = h1 + 23 'Range(Se).Value = h1 & " " & m1 & " " & hc1 'Print note to user if necessary. 'If (h = 0 And 1 > Abs(m)) Then If (h = 0 And maxerror > Abs(m)) Then note = "" Else If (HAHr = 0 And maxerror > Abs(HAMn)) Then Else If (h1 = 0 And 2 > Abs(m1)) Then note = "check H.A. (e vs. w) " & note End If note = h & "h " & Round(m) & "m " & note End If 'Convert angle units to radians RAr = VRA * pie / 12: decr = VDec * pie / 180: Latr = Lat * pie / 180: HAr = VHA * pie / 12 tstartr = tstart * pie / 12: tstopr = tstop * pie / 12 'Compute Altitude Angles: 'For Start Time SinAA = (Cos(RAr) * Cos(tstartr) + Sin(RAr) * Sin(tstartr)) * Cos(decr) * Cos(Latr) + Sin(decr) * Sin(Latr) 'Arcsin(X) = Atn(X / Sqr(-X * X + 1)) AA = Round(Atn(1 / Sqr(1 / (SinAA * SinAA) - 1)) * 180 / pie, 2) 'Print Results If (Left(Trim(Range("Q1").Value), 3) = "Alt") Then Range(Qe).Value = Str(AA) & Chr(176) If (AA >= 0 And AA < AltL) Then Range(Pe).Value = Str(AA) & Chr(176) & " Low Angle" End If If (AA < 0) Then noteM = "Below Horizon at Start " & noteM 'For Stop Time SinAA2 = (Cos(RAr) * Cos(tstopr) + Sin(RAr) * Sin(tstopr)) * Cos(decr) * Cos(Latr) + Sin(decr) * Sin(Latr) AA2 = Sgn(SinAA2) * Round(Atn(1 / Sqr(1 / (SinAA2 * SinAA2) - 1)) * 180 / pie, 2) 'Print Results If (Left(Trim(Range("R1").Value), 3) = "Alt") Then Range(Re).Value = Str(AA2) & Chr(176) If (AA2 >= 0 And AA2 < AltL) Then Range(Qe).Value = Str(AA2) & Chr(176) & " Low Angle" End If If (AA2 < 0) Then noteM = "Below Horizon at Stop " & noteM End If End If End If 'Report messages 'Range(Ie).Value = noteI & Round(exposuretime * 60) Range(Le).Value = note Range(Me1).Value = noteM 'Reset variables to check the next Plate data noteI = "" note = "" noteM = "" lastdate = pagedate Next e 'Display final Message '"All the information in these columns except the time type will be deleted after you have" & Chr(13) & Message = MsgBox("Have you finished checking the logbook data?" & Chr(13) & "Answering yes will delete all the information in columns L through R that are in use (except the time types in column N)." & Chr(13) & "Answer yes after you have finished correcting any typing errors and noting any significant problems in the logbook data.", 4 + 256, "Logbook Data Test Completed") If Message = 6 Then 'Clear Columns Columns("L:M").Select Selection.ClearContents If (Trim(Range("N1").Value) <> "") Then Columns("O:P").Select If (Left(Trim(Range("Q1").Value), 3) = "Alt") Then Columns("O:R").Select Selection.ClearContents End If End Sub