Hi,
this thread is the successor of this one.
I want to sum up (K-) cells depending on the first symbol of another (C-) cell in the same line(s) and post it into an Outlook body.
The cells could be
C16=1a..., K16=5
C17=1b..., K17=5
mysum1=10
Obviously the part of the Range within the loop doesn't depend on the first symbol of the c-row so far, but anyways:Dim mysum1 As Integer Dim mysum2 As Integer ... For Each c In ws.Range("C16", ws.Cells(ws.Rows.Count, 3).End(xlup)) If Left(c.Value, 1) = "1" Then mysum1 = xl.WorksheetFunction.sum(ws.Range("K16:K18")) ElseIf Left(c.Value, 1) = "2" Then mysum2 = xl.WorksheetFunction.sum(ws.Range("K19:K24")) ... ElseIf Left(c.Value, 1) = "45" Then mysum45 = xl.WorksheetFunction.sum(ws.Range("K28:K34")) End If Next ... .Body = "Bandbeschichtung: " & mysum1 _ & vbCrLf & "Walz+Fin " & mysum2 _
It only posts mysum1, no other sum works.
Thanks in advance for any help.
André