ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to add a number of rows after being prompted (https://www.excelbanter.com/excel-programming/282390-macro-add-number-rows-after-being-prompted.html)

Deb[_8_]

Macro to add a number of rows after being prompted
 
I have a spread sheet that is filled in by me before
sending to a customer and will be partially filled in by
customers. Some of the information required by them will
need extra rows. How do I make a macro to add additional
rows below the "original row". (These rows will need to be
inserted between other rows and will be different all the
time.) I would like an input box so they can enter the
number of rows they will need. Any help would be greatly
appreciated. Thank you in advance.

mudraker[_12_]

Macro to add a number of rows after being prompted
 

To get the number of rows required use a standard InputBox command an
test if answer is numeric 0 or false

Dim AddRows
AddRows= InputBox("Insert How Many Rows")
If Not IsNumeric(AddRows) Or AddRows< 1 Then
Exit Sub
End If


How will you determine where the rows are to be added?
set varaible eg

InsertRowAt = 23

Adding x number of rows is easy once you are able to determine wher
they are to go.


Rows(InsertRowAt & ":" & InsertRowAt + AddRows).Inser
Shift:=xlDow

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com


david mcritchie

Macro to add a number of rows after being prompted
 
Hi anonymous poster Deb,
You might also want to take a look at my web page
Insert a Row using a Macro to maintain formulas
http://www.mvps.org/dmcritchie/excel/insrtrow.htm

HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Deb" wrote in message ...
I have a spread sheet that is filled in by me before
sending to a customer and will be partially filled in by
customers. Some of the information required by them will
need extra rows. How do I make a macro to add additional
rows below the "original row". (These rows will need to be
inserted between other rows and will be different all the
time.) I would like an input box so they can enter the
number of rows they will need. Any help would be greatly
appreciated. Thank you in advance.





All times are GMT +1. The time now is 03:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com