ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Inserting Lines using multiple Macros (https://www.excelbanter.com/excel-programming/424395-inserting-lines-using-multiple-macros.html)

P_Kellogg[_2_]

Inserting Lines using multiple Macros
 
I'm able to create a macro that allows me to insert additional lines to a
template as a user needs with no problems. Further down in the sheet I have
an additional macro to insert additional lines as a user needs. If the user
inserts lines with macro #1 and then tries to insert lines with macro #2, the
second macro now has inaccurate row references and places the additional
lines in the wrong location. Is there a way to have the line insertion point
move if additional rows are added above the macro?
Thank you in advance for the support.
Paul

dan dungan

Inserting Lines using multiple Macros
 
Hi Paul,

You'll probably have a more useful experience if you post the code
from each macro.

Dan

mdmackillop[_30_]

Inserting Lines using multiple Macros
 

As with deleting rows, its best to insert from the bottom up.

Try these 2 codes in a block of data to see the difference
Sub Inserts()
For i = 20 To 2 Step -2
Rows(i).Insert
Next
End Sub


Sub Inserts2()
For i = 2 To 20 Step 2
Rows(i).Insert
Next
End Sub


--
mdmackillop
------------------------------------------------------------------------
mdmackillop's Profile: http://www.thecodecage.com/forumz/member.php?userid=113
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=66591



All times are GMT +1. The time now is 09:51 AM.

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