Ich möchte gerne eine Summe berechnen und habe mir folgenden Code gebastelt:
Sub Berechnen()
Dim strKW1 As String
Dim strKW2 As String
Dim strWert As String
Worksheets("Wochen").Activate
Range("Q1").Activate
Do While ActiveCell.Value <> Me.cboRetarder.Value
ActiveCell.Offset(1, 0).Activate
Loop
ActiveCell.Offset(2, 0).Activate
Do While ActiveCell.Value < Val(Me.txtBedarfKW1.Value)
ActiveCell.Offset(0, 1).Activate
Loop
ActiveCell.Offset(3, 0).Activate
strKW1 = ActiveCell.Address
strKW1 = Val(strKW1)
ActiveCell.Offset(-3, 0).Activate
Do While ActiveCell.Value < Val(Me.txtBedarfKW2.Value)
ActiveCell.Offset(0, 1).Activate
Loop
ActiveCell.Offset(3, 0).Activate
strKW2 = ActiveCell.Address
strKW2 = Val(strKW2)
strKW1 = strKW1 & ":" & strKW2
strWert = "=SUM(strKW1)"
Range("Q1").Value = strWert
Me.lblBedarfVoith.Caption = Range("Q1").Value
End Sub
Mein Problem ist, dass ich den Wert nicht dem Label übergeben kann. Wer kann mir da helfen??
Danke TOM