Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
comotoman
 
Posts: n/a
Default Insert Row by a defined Number


I have a macro that inserts a line, how can i modify it to insert a line
by a number in a cell corresponding to the row number?

ex:

J8: "22"
Inserts a new row between rows 22 and 23

J8:"10"
Inserts a new row between rows 10 and 11


--
comotoman
------------------------------------------------------------------------
comotoman's Profile: http://www.excelforum.com/member.php...o&userid=27292
View this thread: http://www.excelforum.com/showthread...hreadid=475101

  #2   Report Post  
zero635
 
Posts: n/a
Default


comotoman Wrote:
I have a macro that inserts a line, how can i modify it to insert a line
by a number in a cell corresponding to the row number?

ex:

J8: "22"
Inserts a new row between rows 22 and 23

J8:"10"
Inserts a new row between rows 10 and 11


Comotoman,

Not sure if this is what you are looking for but hope it helps. Let me
know.

Sub InsertRow()
Rows("23:23").Select
Selection.Insert Shift:=xlDown
Rows("11:11").Select
Selection.Insert Shift:=xlDown
End Sub


This will insert rows between 22 and 23 and 10 and 11.

Good Luck,
zero


--
zero635
------------------------------------------------------------------------
zero635's Profile: http://www.excelforum.com/member.php...o&userid=24802
View this thread: http://www.excelforum.com/showthread...hreadid=475101

  #3   Report Post  
comotoman
 
Posts: n/a
Default


Sub InsertRow()
Rows("23:23").Select
Selection.Insert Shift:=xlDown
Rows("11:11").Select
Selection.Insert Shift:=xlDown
End Sub

i need the row number determined by a cell on the active sheet.

j8: '15'
Sub InsertRow()
Rows("15:15").Select
Selection.Insert Shift:=xlDown
End Sub


--
comotoman
------------------------------------------------------------------------
comotoman's Profile: http://www.excelforum.com/member.php...o&userid=27292
View this thread: http://www.excelforum.com/showthread...hreadid=475101

  #4   Report Post  
zero635
 
Posts: n/a
Default


comotoman Wrote:
Sub InsertRow()
Rows("23:23").Select
Selection.Insert Shift:=xlDown
Rows("11:11").Select
Selection.Insert Shift:=xlDown
End Sub

i need the row number determined by a cell on the active sheet.

j8: '15'
Sub InsertRow()
Rows("15:15").Select
Selection.Insert Shift:=xlDown
End Sub


I tried this code and based on the cell value in J8 it will jump down
to that line and insert a row.

Sub Insert()
Rows(Range("j8")).Select
Selection.Insert Shift:=xlDown
End Sub

If you use this code it will place one under to insert under the value
of J8 or you could do negative to do it above.

Sub Insert()
Rows(Range("j8") + 1).Select
Selection.Insert Shift:=xlDown
End Sub

Maybe alittle closer to what you need?

zero


--
zero635
------------------------------------------------------------------------
zero635's Profile: http://www.excelforum.com/member.php...o&userid=24802
View this thread: http://www.excelforum.com/showthread...hreadid=475101

  #5   Report Post  
comotoman
 
Posts: n/a
Default


Thats it, thanks


--
comotoman
------------------------------------------------------------------------
comotoman's Profile: http://www.excelforum.com/member.php...o&userid=27292
View this thread: http://www.excelforum.com/showthread...hreadid=475101

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
Number of labels on X-axis one more than number of values on Y-axi Gudrun Charts and Charting in Excel 5 August 26th 05 01:55 PM
Insert a Seperator into a number string. DraCo Excel Discussion (Misc queries) 3 August 22nd 05 02:24 PM
Count Number of Characters in a cell? AHJuncti Excel Discussion (Misc queries) 2 June 16th 05 07:39 PM
Need number of Saturdays and number of Sundays between 2 dates Class316 Excel Worksheet Functions 1 June 10th 05 02:47 AM
How to format a number in Indian style in Excel? Victor_alb Excel Discussion (Misc queries) 2 December 21st 04 04:21 AM


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