If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
sequential counter
I have a column of species and a row of plots as follows:
PLOT: 1 2 3 4 5 Spp1 Spp2 Spp3 Spp4 Spp5 .... to Spp 150 I want to be able to do a sequential counter so that when I hit a key, e.g. "3" it will add 1 to the Spp3 cell every time I hit the key. Is there any way to do this? Thanks David |
#2
|
|||
|
|||
sequential counter
sequential counter Is there any way to do this?
Probably. Which is "the Spp3 cell"? -- under Plot 1, 2, 3, 4, or 5? Rgds, Andy |
#4
|
|||
|
|||
sequential counter
The Spp3 will apply to all plots but one at a time. for example I will do
all the species in plot one then all the species in plt 2 etc etc so one column at a time OK, try some code (NB - this could probably be *a lot* cleaner since I don't really do code but seems to work). In a regular module, 2 subs (AKA "macros" or "procedures") - Sub OnKeyPlus() Application.OnKey "{ENTER}", "Add1" End Sub Sub Add1() n = ActiveCell.Value x = ActiveCell.Column Range("A1").Offset(n, x - 1).Value = Range("A1").Offset(n, x - 1).Value + 1 ActiveCell.Value = x - 1 n = 0 x = 0 OnKeyPlus End Sub Run the first one manually. Then you can select any plot header (B1 thru F1, it seems to me), type eg: 28, press Enter (number keypad). The relevant row/column intersect (if you selected C1, then C29 or Spp28 for Plot2) should increment by 1. HTH, Andy |
#5
|
|||
|
|||
sequential counter
Perhaps this will do:
assumes header row is row 1, data starts in row 2 ="Spp"&ROW()-1 copy down 2rrs David Webster wrote in message ... I have a column of species and a row of plots as follows: PLOT: 1 2 3 4 5 Spp1 Spp2 Spp3 Spp4 Spp5 ... to Spp 150 I want to be able to do a sequential counter so that when I hit a key, e.g. "3" it will add 1 to the Spp3 cell every time I hit the key. Is there any way to do this? Thanks David -- |
Thread Tools | |
Display Modes | |
|
|