S
Stephen William Foyle
Hello, I am trying to write a macro that will add the values in a range of
cells with the values in the adjecent cells then clear those adjecent cells.
I have "hard coded" the macro by typing in each and every cell address, this
works, but I would like to use a For Loop:
---------------------------------
Sub OptionButton1_Click()
Dim z As Integer
For z = 8 To 22
Range("iz").Value2 = Range("iz").Value2 + Range("jz").Value2
Range("jz").Value2 = ""
Next z
For z = 26 To 40
Range("iz").Value2 = Range("iz").Value2 + Range("jz").Value2
Range("jz").Value2 = ""
Next z
For z = 46 To 51
Range("iz").Value2 = Range("iz").Value2 + Range("jz").Value2
Range("jz").Value2 = ""
Next z
End Sub
cells with the values in the adjecent cells then clear those adjecent cells.
I have "hard coded" the macro by typing in each and every cell address, this
works, but I would like to use a For Loop:
---------------------------------
Sub OptionButton1_Click()
Dim z As Integer
For z = 8 To 22
Range("iz").Value2 = Range("iz").Value2 + Range("jz").Value2
Range("jz").Value2 = ""
Next z
For z = 26 To 40
Range("iz").Value2 = Range("iz").Value2 + Range("jz").Value2
Range("jz").Value2 = ""
Next z
For z = 46 To 51
Range("iz").Value2 = Range("iz").Value2 + Range("jz").Value2
Range("jz").Value2 = ""
Next z
End Sub