Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 210
Default Automatically Increment numerically ordered rows

I have code that automatically copies a row and then inserts new rows in a
worksheet that are copies of that row, based on a number entered by a user
through an InputBox. The first cell in the row contains a number that needs
to increment as the new rows are inserted. In other words, in the row that
is copied there is a cell with a value of '1' and I need that value to be
incremented for each new row that is inserted. So, if Excel inserts ten
additional rows, that number should be incremented from '1' in the copied row
all the way to '11' in the newly inserted rows.

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default Automatically Increment numerically ordered rows

Post your code...
--
HTH...

Jim Thomlinson


"Robin" wrote:

I have code that automatically copies a row and then inserts new rows in a
worksheet that are copies of that row, based on a number entered by a user
through an InputBox. The first cell in the row contains a number that needs
to increment as the new rows are inserted. In other words, in the row that
is copied there is a cell with a value of '1' and I need that value to be
incremented for each new row that is inserted. So, if Excel inserts ten
additional rows, that number should be incremented from '1' in the copied row
all the way to '11' in the newly inserted rows.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Automatically Increment numerically ordered rows

Suppose lngRow is the row number where a row is to inserted

lngRow = 5
Rows(lngRow).Insert
Rows(lngRow).Range("A1") = Rows(lngrow - 1).Range("A1") + 1

If this post helps click Yes
---------------
Jacob Skaria


"Robin" wrote:

I have code that automatically copies a row and then inserts new rows in a
worksheet that are copies of that row, based on a number entered by a user
through an InputBox. The first cell in the row contains a number that needs
to increment as the new rows are inserted. In other words, in the row that
is copied there is a cell with a value of '1' and I need that value to be
incremented for each new row that is inserted. So, if Excel inserts ten
additional rows, that number should be incremented from '1' in the copied row
all the way to '11' in the newly inserted rows.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 210
Default Automatically Increment numerically ordered rows

Jim here is the code


Here is the code that copies and inserts the rows:
Sub copyrows()

numrows = InputBox("Number of rows")
'Rows(ActiveCell.Row).Copy ActiveCell.Resize(numrows)
Rows(ActiveCell.Row).Copy
ActiveCell.Resize(numrows).Insert
Application.CutCopyMode = False

End Sub

Thanks!



"Jim Thomlinson" wrote:

Post your code...
--
HTH...

Jim Thomlinson


"Robin" wrote:

I have code that automatically copies a row and then inserts new rows in a
worksheet that are copies of that row, based on a number entered by a user
through an InputBox. The first cell in the row contains a number that needs
to increment as the new rows are inserted. In other words, in the row that
is copied there is a cell with a value of '1' and I need that value to be
incremented for each new row that is inserted. So, if Excel inserts ten
additional rows, that number should be incremented from '1' in the copied row
all the way to '11' in the newly inserted rows.

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
Automatically Increment Row Numbers Jen New Users to Excel 9 November 19th 08 08:25 AM
Sorting rows left to right numerically Carlton A. Barlow Excel Worksheet Functions 1 December 2nd 07 12:40 AM
automatically increment y-axis daily Peter Dacre Charts and Charting in Excel 1 October 2nd 06 02:31 PM
automatically increment field by one Dingbat Excel Discussion (Misc queries) 2 October 25th 05 08:18 PM
increment cell value automatically Gummy Excel Worksheet Functions 0 November 5th 04 10:30 PM


All times are GMT +1. The time now is 12:35 AM.

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"