A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

sequential counter



 
 
Thread Tools Display Modes
  #1  
Old September 17th, 2003, 11:04 AM
David Webster
external usenet poster
 
Posts: n/a
Default 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  
Old September 17th, 2003, 12:31 PM
Andy Brown
external usenet poster
 
Posts: n/a
Default 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  
Old September 17th, 2003, 01:24 PM
Andy Brown
external usenet poster
 
Posts: n/a
Default 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  
Old September 17th, 2003, 07:34 PM
2rrs
external usenet poster
 
Posts: n/a
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:46 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.