sassriverrat
Well-known Member
- Joined
- Oct 4, 2018
- Messages
- 655
Someone on here wrote this for me and I haven't been able to get back in touch for a few questions.
Basically this is supposed to add the figures in Cell N10 from all sheets named "Noon" + Index # (i.e. Noon, Noon2, Noon3, Noon4 etc) as well as from R17 from the "Arrival" Sheet. The total for this number goes into cell R10 on the "Arrival" (Active) Sheet. The number of "Noon" sheets is a varying number (there's a macro that generates new ones as necessary) and sometimes there are zero "Noon" sheets. There is ALWAYS an arrival sheet and it's always the last sheet in the workbook. There are 4 sheets in the beginning of the workbook (developer, notes, ports, voyage specifics) before the first possible noon or the arrival- we don't add figures from any of these first four pages.
I'm not exactly sure how to set this up to add as I want it to. Maybe someone can explain or tweak if necessary.
Basically this is supposed to add the figures in Cell N10 from all sheets named "Noon" + Index # (i.e. Noon, Noon2, Noon3, Noon4 etc) as well as from R17 from the "Arrival" Sheet. The total for this number goes into cell R10 on the "Arrival" (Active) Sheet. The number of "Noon" sheets is a varying number (there's a macro that generates new ones as necessary) and sometimes there are zero "Noon" sheets. There is ALWAYS an arrival sheet and it's always the last sheet in the workbook. There are 4 sheets in the beginning of the workbook (developer, notes, ports, voyage specifics) before the first possible noon or the arrival- we don't add figures from any of these first four pages.
I'm not exactly sure how to set this up to add as I want it to. Maybe someone can explain or tweak if necessary.
Code:
Private Sub TotalNoonSheetAdder()'Has the ability to add all values from multiple noons and a single cell selection
WS_Count = ActiveWorkbook.Worksheets.Count
Eqat = "="
nooncnt = 0
For i = 1 To WS_Count
Tname = ActiveWorkbook.Worksheets(i).Name
If Left(Tname, 4) - "Noon" Then
Eqat = Eqat & "+" & "Noon" & "!N12"
nooncnt = nooncnt + 1
End If
Next i
If nooncnt > 0 Then
ActiveCell.Formula = Eqat & "+R10"
End If
End Sub
Last edited: