Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Inserting line numbers into the first column of an excel worksheet


I have an excel sheet that has the title row as the first row. The rows
containing the data can start upto 5 rows below the title row leaving
blank rows in between. I want to insert a column as the first column
containing line numbers for the rows with the data. The line numbers
have to start from the row where the data exists leaving the above
blank rows. Is it possible to do this programmatically using C#. I
tried using an identity column but it didn't work. The error says
"Invalid Operation". Please help! Thanks in advance.


--
rkappini
------------------------------------------------------------------------
rkappini's Profile: http://www.excelforum.com/member.php...o&userid=31216
View this thread: http://www.excelforum.com/showthread...hreadid=508883

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 510
Default Inserting line numbers into the first column of an excel worksheet

Hi

Into cell A5 enter the formula
=IF(B5="","",ROW()-4)
or
=IF(AND(B5="",A6=""),"",ROW()-4)

The first one leaves row number empty, when there is no entry on row, the
second one numberes all rows until last non-empty one.
Instead B5="" you can have some other entry existence check for row 5 -
depending on your table setup. P.e. like this
=IF(AND(COUNTA($B5:X5)=0,A6=""),"",ROW()-4)

Copy the formula down for any reasonable amount of rows


--
Arvi Laanemets
( My real mail address: arvi.laanemets<attarkon.ee )



"rkappini" wrote in
message ...

I have an excel sheet that has the title row as the first row. The rows
containing the data can start upto 5 rows below the title row leaving
blank rows in between. I want to insert a column as the first column
containing line numbers for the rows with the data. The line numbers
have to start from the row where the data exists leaving the above
blank rows. Is it possible to do this programmatically using C#. I
tried using an identity column but it didn't work. The error says
"Invalid Operation". Please help! Thanks in advance.


--
rkappini
------------------------------------------------------------------------
rkappini's Profile:
http://www.excelforum.com/member.php...o&userid=31216
View this thread: http://www.excelforum.com/showthread...hreadid=508883



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
inserting a row into a column that is read on another worksheet Max Excel Worksheet Functions 3 January 10th 07 11:18 PM
inserting a dash into a column of numbers pm Excel Worksheet Functions 6 November 8th 06 09:51 PM
in excel worksheet, add numbers in column k2&k3 monroe Excel Worksheet Functions 1 February 28th 06 12:42 AM
line and column numbers robhargreaves Excel Discussion (Misc queries) 1 August 2nd 05 03:08 PM
Counter for inserting sequence of numbers in Column C Mike Excel Programming 2 January 12th 05 06:06 PM


All times are GMT +1. The time now is 03:04 AM.

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

About Us

"It's about Microsoft Excel"