Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Adding rows dynamically via macro

Hi,

I understand that if I add 4 rows from row 17 onwards, the command
reads as follows:

Sub Insert()
Rows("17:20").Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlDown
End Sub

I would like to modify this for 2 scenarios:

Scenario 1: Now, what if I don't specify 4 rows, but I want it to read
the number-of-rows-to-be-added from a certain cell from a different
worksheet eg: T4 or cell(4, 20) from worksheet 2, because that number
is to modifiable?

Scenario 2: What if I want to add 4 rows, but not necessarily from row
17 - instead, I might want to add 4 rows from any initial row?

Scenario 3: Now combine the 2 scenarios. What if for row 4, I want it
to add a number of rows specified in cell(4, 20) and then for row 5, I
want to add a number of rows specified in cell (5, 20) and so on, for
100 times?

Thanking you in advance.

SD

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
Dynamically Adding Textbox To Frame sarndt Excel Worksheet Functions 0 March 15th 10 06:19 PM
Adding values in first "X" number of rows dynamically MattyP Excel Worksheet Functions 3 April 15th 09 06:13 PM
Dynamically adding a macro to a new worksheet Fred Russell Excel Programming 4 September 11th 05 10:31 PM
Dynamically adding code Martin Walke Excel Programming 2 October 21st 04 12:18 PM
Adding button dynamically lagodch Excel Programming 1 October 7th 03 10:14 PM


All times are GMT +1. The time now is 02:35 PM.

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"