I just started with visual basic and was trying to make a button for two different types of machines. In case of one type the formula i got for a row of 20 cells (same formula for every cell) got a + in it and the other one a minus.

So I want to change the formula by selection one of the two types.

so i got something like this
a) b)
x y x+y x y x-y
x y x+y x y x-y
x y x+y x y x-y
x y x+y x y x-y
x y x+y x y x-y

lets say x is one value and doesnt change and y is different on every line.

Till now I made this:

Private Sub OptionButton1_Click()
Dim d As Integer
Dim r1 As Integer

d = Range("b7")
r1 = Range("b5")

If OptionButton1.Value = True Then
Range("k5").Select
Selection.Clear
Range("k5").Value = r1
End If

End Sub

Private Sub OptionButton2_Click()
Dim d As Integer
Dim r1 As Integer

d = Range("b7")
r1 = Range("b5")

If OptionButton2.Value = True Then
Range("k5").Select
Selection.Clear
Range("k5").Value = d
End If

End Sub


But I want to change "k5" into k5-k25 and r1 imported from excel (r1 is changing). For d i can just use an integer, but i cant figure out what i can use for r1 and how i can let visual basic fill in k5-k25 in excel