Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 1
Cool Automatically Insert New Rows

I have a spreadsheet where I need to copy a row and have EXCEL automatically copy new rows based on a number inputted by the user (less 1).

I've used a code which was previously posted that creates a box asking how many rows I need. This works fine but the problem is that people often input one row too many
For example: If they need 10 rows overall , they inadvertently input a 10 ... giving a total of 11 rows (the original row + the 10 NEW rows) )

So I was wondering if anyone would know how to fine tune the code so that it would give me one less row than what the user inputs.

Here's the code that I use:

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 for any Help
  #2   Report Post  
Junior Member
 
Posts: 5
Default

Conditional format formula is =MOD(ROW(),2)=0 select row format and apply to all rows. This will leave odd rows uncoloured. If even rows to be coloured make formula =1 instead.
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
Insert a rows automatically jetanddug Excel Worksheet Functions 3 October 31st 09 03:15 AM
How do I automatically insert rows colwyn Excel Discussion (Misc queries) 13 September 11th 08 09:16 PM
automatically insert new rows in a list Brighella Setting up and Configuration of Excel 1 March 14th 08 08:37 AM
Automatically insert rows with formula susy Excel Worksheet Functions 10 November 21st 07 01:03 PM
Automatically Insert New Rows Eric Excel Discussion (Misc queries) 0 June 12th 07 10:54 PM


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