Fügen Sie diesen Code in ein Standardmodul ein und führen Sie ihn aus. Sagen Sie mir, ob dies in der Nähe von dem ist, was Sie suchen. okay? Ich habe Ihnen auch eine Beispielarbeitsmappe gegeben. =)
Option Explicit
Sub Button1_Click()
Dim first As Long
Dim last As Long
Dim row As Long
Dim r As Range
Dim r2 As Range
Dim rCount As Range
Dim rAddress As String
Dim rAddress2 As String
Dim c As Long
Dim c2 As Long
Dim colLast As Long
Dim colFirst As Long
Dim sum As Double
first = 2
last = Range("a5000", Range("a5000").End(xlUp)).row
colFirst = 1
For c = first To last
sum = 0
row = c
Set r = Range("a" & CStr(row))
Set r2 = r.End(xlToRight)
rAddress = r.AddressLocal
rAddress2 = r2.AddressLocal
colLast = r2.Column
For c2 = colFirst To colLast
If c2 Mod 2 <> 1 Then 'this is a column to add to total
sum = sum + Cells(row, c2)
End If
Next c2
r2.Offset(0, 1) = sum
'Debug.Print sum
Next c
End Sub
https://docs.microsoft.com/en-us/dot...s/mod-operator
Bookmarks