sassriverrat
Well-known Member
- Joined
- Oct 4, 2018
- Messages
- 655
Just picking up this piece of coding after leaving it for 4 months....I want to remind myself so I correctly modify it....
The coding works as it should, but here is what it should be doing:
It checks if the previous sheet is called "Noon#" (meaning Noon or Noon2, Noon 3, etc) then adds N14 from each sheet named "Noon#". It then adds this sum with R21 and creates this as a time (in decimal form- so increments of 6).
How I would like to tweak- I want to finish the IF basically, so if the the previous sheet is not a "Noon" sheet of some sort, it will JUST make the cell equal to R21 (basically just won't add the previous sheets since they don't exist). thanks for the help!
The coding works as it should, but here is what it should be doing:
It checks if the previous sheet is called "Noon#" (meaning Noon or Noon2, Noon 3, etc) then adds N14 from each sheet named "Noon#". It then adds this sum with R21 and creates this as a time (in decimal form- so increments of 6).
How I would like to tweak- I want to finish the IF basically, so if the the previous sheet is not a "Noon" sheet of some sort, it will JUST make the cell equal to R21 (basically just won't add the previous sheets since they don't exist). thanks for the help!
Code:
WS_Count = ActiveWorkbook.Worksheets.Count Eqat3 = "="
nooncnt = 0
For i = 1 To WS_Count
Tname = ActiveWorkbook.Worksheets(i).Name
If Left(Tname, 4) = "Noon" Then
Eqat3 = Eqat3 & "+" & Tname & "!N14"
nooncnt = nooncnt + 1
End If
Next i
If nooncnt > 0 Then
Range("N12").Formula = Eqat3 & "+R21"
End If
If IsNumeric(Range("D8").Value) Then
If Range("R21").Value > (Range("D8").Value + (Range("F8").Value / 60)) Then
Range("N10").Value = "Error"
End If
End If
Range("N29").FormulaR1C1 = "=R[-17]C"
Range("N46").FormulaR1C1 = "=R[-17]C"