Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
dshemesh
 
Posts: n/a
Default Automatic numbering in excel

Hello, I am very novice in excel, and have encountered the following problem:
I have a file with a few tables (I use page breaks between 2 tables). The
first column of each table is a serial number column. So I want this column
to automatically start from number 1 (not including the first row, which is a
title row), and keep going, until a page break is encountered (but not when a
regular page ends). How can I do this? I want it of course to handle new
lines as well (every line that I add or remove from a table should change all
serial numbers as needed).

thanks,
--
dshemesh
  #2   Report Post  
Posted to microsoft.public.excel.newusers
Ed Ferrero
 
Posts: n/a
Default Automatic numbering in excel

Hi dshemesh,

You colud do this with a macro.

Copy the code below (between the ====) to the Visual Basic Editor in Excel.

(In Excel press Alt-F11 to open the VBE, then InsertModule)

Then select the cell where you want the serial numbers to start, and run the
macro.

'================================================= ========================
Sub SetIncrements()
Dim r As Range
Dim i, j As Integer

Set r = Selection

If r.Cells.Count 1 Then
MsgBox "Select one cell only"
Exit Sub
End If

j = 0

For i = 0 To ActiveSheet.UsedRange.Cells(ActiveSheet.UsedRange. Rows.Count,
1).Row - r.Row
j = j + 1
If r.Offset(i, 0).EntireRow.PageBreak = xlPageBreakManual Then j = 1
r.Offset(i, 0).Value = j
Next i

End Sub
'================================================= ========================

Ed Ferrero
http://www.edferrero.com

Hello, I am very novice in excel, and have encountered the following
problem:
I have a file with a few tables (I use page breaks between 2 tables). The
first column of each table is a serial number column. So I want this
column
to automatically start from number 1 (not including the first row, which
is a
title row), and keep going, until a page break is encountered (but not
when a
regular page ends). How can I do this? I want it of course to handle new
lines as well (every line that I add or remove from a table should change
all
serial numbers as needed).

thanks,
--
dshemesh



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2003 FAILS, but Excel 2000 SUCCEEDS ??? Richard Excel Discussion (Misc queries) 2 May 13th 23 11:46 AM
Need Help with Excel page numbering uclabennett New Users to Excel 0 October 5th 05 04:55 PM
How to import automatic corrections from Word to Excel? ofreeb Setting up and Configuration of Excel 1 August 2nd 05 04:34 PM
Automatic data conversion in Excel Dejan Excel Discussion (Misc queries) 2 July 26th 05 09:22 PM
Automatic links in Excel 2003 Jim Bud Excel Discussion (Misc queries) 4 January 13th 05 03:57 PM


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

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

About Us

"It's about Microsoft Excel"