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 Word » Tables
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Auto number a column in table using SEQ



 
 
Thread Tools Display Modes
  #1  
Old March 19th, 2006, 02:01 AM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default Auto number a column in table using SEQ

Hi there

I have created a table and have used the SEQ formula to have a
sequential number in the first column. When I copy the row the SEQ
works fine - i.e. it auto-increments the number. But if I tab through
the row (the last row of the table) and it creates a new row the SEQ is
obviously not there. I can understand the logic of that but is there
some other way of having a sequential number automatically
incrementating that will work if I copy the row as well as tabbing
through the last row on the table.

Cheers
Kaz

  #2  
Old March 19th, 2006, 02:05 AM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default Auto number a column in table using SEQ

Actuslly, can I add another bit to this question? I see that I can use
standard list numbering to achieve the sequential number bit. But I am
also using a Count function to count the number of rows. When I use
standard list numbering my Count function doesn't work anymore.

  #3  
Old March 19th, 2006, 08:37 AM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default Auto number a column in table using SEQ

Where and for what are you using the count function. The number in the last
row will equal the count will it not?

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"kaz" wrote in message
ups.com...
Actuslly, can I add another bit to this question? I see that I can use
standard list numbering to achieve the sequential number bit. But I am
also using a Count function to count the number of rows. When I use
standard list numbering my Count function doesn't work anymore.



  #4  
Old March 19th, 2006, 08:21 PM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default Auto number a column in table using SEQ

I have a field, outside of the table, that needs to display the count
of the number of items in the table (excluding the header row).

  #5  
Old March 19th, 2006, 10:33 PM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default Auto number a column in table using SEQ

You might want to have a look at
http://gregmaxey.mvps.org/Table_Cell_Data.htm. If this macro doesn't do what
you need, perhaps Greg could enhance it so that it would. I would think that
any macro that could put information in the status bar could also write it
to a document property or variable that could be picked up in the doc with a
DocProperty or DocVariable field.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"kaz" wrote in message
oups.com...
I have a field, outside of the table, that needs to display the count
of the number of items in the table (excluding the header row).


  #6  
Old March 19th, 2006, 11:22 PM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default Auto number a column in table using SEQ

Wow, that looks pretty complex. I thought I could do something as
simple as using Count pointing to the column in the table (where I have
bookmarked the table). I do have a good book that shows me how to get
the information from the status bar so will work on that. If there is a
simpler solution can someone please let me know.

  #7  
Old March 19th, 2006, 11:32 PM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default Auto number a column in table using SEQ

Alot will depend on how you define an "item." Do you mean a cell containing
any text?

Something like this may do. You can nest a docvarialbe field in a macro
button field to execute:

Sub ScratchMacro()
Dim oTbl As Word.Table
Dim i&
Dim rowCnt&
Dim colCnt&
Dim myVar As Variable
Set oTbl = ActiveDocument.Tables(1)
For rowCnt = 2 To oTbl.Rows.Count
For colCnt = 1 To oTbl.Columns.Count
If Len(oTbl.Cell(rowCnt, colCnt).Range.Text) 2 Then
i = i + 1
End If
Next colCnt
Next rowCnt
ActiveDocument.Variables("myVar").Value = i
ActiveDocument.Fields.Update
End Sub

The field will look something like this:

{ Macrobutton Scratchmacro {DocVariable myVar}}

--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.


Suzanne S. Barnhill wrote:
You might want to have a look at
http://gregmaxey.mvps.org/Table_Cell_Data.htm. If this macro doesn't
do what you need, perhaps Greg could enhance it so that it would. I
would think that any macro that could put information in the status
bar could also write it to a document property or variable that could
be picked up in the doc with a DocProperty or DocVariable field.


"kaz" wrote in message
oups.com...
I have a field, outside of the table, that needs to display the count
of the number of items in the table (excluding the header row).



  #8  
Old March 20th, 2006, 01:33 AM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default Auto number a column in table using SEQ

Yes, I guess a cell containing any text. What I have is a table where
the first column is a sequential number, automatically generated for
each new row. I am currently creating that number just using standard
list numbering. I did have my field (outside of the table) simply doing
a COUNT on that first column but that doesn't work. I am guessing that
is because Word doesn't recognise the content of the field as being
numeric?!? So if I use the code described by Greg, how do I ensure that
is pointed to that specific table (as my document has a few other
tables in it). When I was trying to do this using COUNT I had
bookmarked the table in question and used that bookmark name in the
COUNT function. Do I just change the "Set oTbl" statement to point to
the bookmark?

  #9  
Old March 20th, 2006, 02:13 AM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default Auto number a column in table using SEQ

Kaz,

Provided that your bookmark spans only the table of interest, you could use
this line (all on one line):

Set oTbl = ActiveDocument.Bookmarks("mytable").Range.Tables(1 )

where "mytable" stands in for the name of your bookmark.

--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.


kaz wrote:
Yes, I guess a cell containing any text. What I have is a table where
the first column is a sequential number, automatically generated for
each new row. I am currently creating that number just using standard
list numbering. I did have my field (outside of the table) simply
doing a COUNT on that first column but that doesn't work. I am
guessing that is because Word doesn't recognise the content of the
field as being numeric?!? So if I use the code described by Greg, how
do I ensure that is pointed to that specific table (as my document
has a few other tables in it). When I was trying to do this using
COUNT I had bookmarked the table in question and used that bookmark
name in the COUNT function. Do I just change the "Set oTbl" statement
to point to the bookmark?



  #10  
Old March 20th, 2006, 03:10 AM posted to microsoft.public.word.tables
external usenet poster
 
Posts: n/a
Default Auto number a column in table using SEQ

Hi Greg

I'm getting there (slowly). So, my macro is now giving me the result I
want and I can get the result displayed in the required place in the
document. But I have achieved this by manually running the macro then
updating the field using F9. I am guessing that the command "{
Macrobutton Scratchmacro {DocVariable myVar}} " that you supplied is
supposed to run the macro as well as displaying the variable but I
can't get that to work. I'm (obviously) new to all of this so it is
probably the way I am creating / recording the macro or the actual
syntax. Can you please just help me one more time?

Cheers
Kaz

 




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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Update a number field incrementally AllyOop Running & Setting Up Queries 7 February 22nd, 2006 12:38 PM
page number positioning and format tinaa Page Layout 3 February 4th, 2006 12:38 AM
Query is not updatable - Doug Johnson via AccessMonster.com Running & Setting Up Queries 3 January 21st, 2006 12:36 AM
Need Subforms? AccessRookie Using Forms 7 April 8th, 2005 09:30 AM
Using Validation to force entry into cells? Mark General Discussion 16 October 27th, 2004 09:23 PM


All times are GMT +1. The time now is 09:12 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.