stevelizelsa
New Member
- Joined
- Sep 25, 2015
- Messages
- 5
Hello. So I am making a spreadsheet that is full of button counters (110 + and 110 -). I found a thread from 2010 that gives a pretty good code for making the button add or subtract from a specific cell
~Sub count()
Dim x As Integer
x = Range("A1").Value
Range("A1").Value = x + 1
End Sub
however what I am looking for is a similar macro that I can attach to each button that simply has the button add or subtract from the same row that the button is located but in column B. That way if I insert a new row in the middle the buttons still add or subtract from the correct cell immediately to the left i.e.
a b c d
1 + -
2 + -
with the above code if I were to insert a row between 1 and 2 the button in b2 would become b3 but would still add to cell d2 instead of d3
a single code that said add to cell column b row same as button and could attach it individually to all the buttons instead of new code for each button that would be fantastic
Not sure if this is possible as I know very little of coding but any help would be highly appreciated
Thanks
Steve
~Sub count()
Dim x As Integer
x = Range("A1").Value
Range("A1").Value = x + 1
End Sub
however what I am looking for is a similar macro that I can attach to each button that simply has the button add or subtract from the same row that the button is located but in column B. That way if I insert a new row in the middle the buttons still add or subtract from the correct cell immediately to the left i.e.
a b c d
1 + -
2 + -
with the above code if I were to insert a row between 1 and 2 the button in b2 would become b3 but would still add to cell d2 instead of d3
a single code that said add to cell column b row same as button and could attach it individually to all the buttons instead of new code for each button that would be fantastic
Not sure if this is possible as I know very little of coding but any help would be highly appreciated
Thanks
Steve
Last edited: