pinchy1964
New Member
- Joined
- Aug 15, 2007
- Messages
- 9
Hi all,
I'm new to VB so may be asking a daft question but hey, if I don't ask, I won't know
I am trying to add counters to a simple spreadsheet where each time a cell is modified, the cell next to it will increment.
I can do it for a single row but would like a simple way of applying to every row in a range without having to have a huge number of lines to apply the count to each row eg for a single row I am using -
But would like to apply to all rows up to row 100 for example -
In this example, how can I apply this count without having 100 lines of code (one for each row) - Hope I'm making sense
Thanks.
I'm new to VB so may be asking a daft question but hey, if I don't ask, I won't know
I am trying to add counters to a simple spreadsheet where each time a cell is modified, the cell next to it will increment.
I can do it for a single row but would like a simple way of applying to every row in a range without having to have a huge number of lines to apply the count to each row eg for a single row I am using -
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then [B1].Value = [B1].Value + 1
End Sub
But would like to apply to all rows up to row 100 for example -
Code:
If Target.Address = "$A$100" Then [B100].Value = [B100].Value + 1
In this example, how can I apply this count without having 100 lines of code (one for each row) - Hope I'm making sense
Thanks.