Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 29
Default how do i write a macro that will add rows into a spreadsheet

im trying to add 15 rows in between each row in a spreadsheet
all of which contain information i would like to use as headers
i have approximately 1600 rows in this worksheet
im assuming a macro may be the easiest way to do this but am open to any
suggestions that any of you may have
thank you for your assistance
brock

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 98
Default how do i write a macro that will add rows into a spreadsheet

Hi BROCK:

This should work if you paste it into a module.

If you need any further help, please let me know.

Thanks,

Simon

Sub Row_Adder()
Dim curr_row, no_insert, start_row, exec_loop, offset, ins_stop, i As Integer

' Set the row you want the code to start running from
start_row = 20

'Set the number of rows you want to insert
no_insert = 15

'Set the number of times you want this code to run
exec_loop = 20

'Set the number of rows you want to offset each time. eg: if you
'want to insert 10 rows then move down 5 rows before inserting
'the next ten
offset = 2


'Move to the start

Rows(start_row).Select


For i = 1 To exec_loop

curr_row = ActiveCell.Row
ins_stop = curr_row + no_insert

'Select and insert the rows

Rows(curr_row & ":" & ins_stop).Select
Selection.Insert Shift:=xlDown

'select the bottom of your insert
Rows(ins_stop).Select

'move to the offset
Rows(ActiveCell.Row + offset).Select

Next i


End Sub


BROCK8292 wrote:
im trying to add 15 rows in between each row in a spreadsheet
all of which contain information i would like to use as headers
i have approximately 1600 rows in this worksheet
im assuming a macro may be the easiest way to do this but am open to any
suggestions that any of you may have
thank you for your assistance
brock


--
--------------------
Simon - UK

Email at simon22mports [ a t ] hot mail [ d ot ]com

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200704/1

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 29
Default how do i write a macro that will add rows into a spreadsheet

thank you for your help smw226
the language you provided worked perfectly
so perfectly in fact that i was wondering if i might push my luck
my workbook contains two worksheets
worksheet 1 has 1600 rows of information
worksheet 2 has basically the same info but each row that contains that info
is now seperated by 15 lines thanx to you
is there a way to insert hyperlinks into column A of worksheet 1 that will
link each row to its corresponding row in worksheet 2?
any advice on this matter will be greatly appreciated and thank you for the
time youve already spent on me
brock

"smw226 via OfficeKB.com" wrote:

Hi BROCK:

This should work if you paste it into a module.

If you need any further help, please let me know.

Thanks,

Simon

Sub Row_Adder()
Dim curr_row, no_insert, start_row, exec_loop, offset, ins_stop, i As Integer

' Set the row you want the code to start running from
start_row = 20

'Set the number of rows you want to insert
no_insert = 15

'Set the number of times you want this code to run
exec_loop = 20

'Set the number of rows you want to offset each time. eg: if you
'want to insert 10 rows then move down 5 rows before inserting
'the next ten
offset = 2


'Move to the start

Rows(start_row).Select


For i = 1 To exec_loop

curr_row = ActiveCell.Row
ins_stop = curr_row + no_insert

'Select and insert the rows

Rows(curr_row & ":" & ins_stop).Select
Selection.Insert Shift:=xlDown

'select the bottom of your insert
Rows(ins_stop).Select

'move to the offset
Rows(ActiveCell.Row + offset).Select

Next i


End Sub


BROCK8292 wrote:
im trying to add 15 rows in between each row in a spreadsheet
all of which contain information i would like to use as headers
i have approximately 1600 rows in this worksheet
im assuming a macro may be the easiest way to do this but am open to any
suggestions that any of you may have
thank you for your assistance
brock


--
--------------------
Simon - UK

Email at simon22mports [ a t ] hot mail [ d ot ]com

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200704/1


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 98
Default how do i write a macro that will add rows into a spreadsheet

Hi Brock,

Just to confirm my uderstanding:

Do you want, for example, the first hyperlink in sheet!A1 to reference Sheet2!
A1, then Sheet!A2 to reference Sheet2!A16 etc ?

Thanks,

Simon



BROCK8292 wrote:
thank you for your help smw226
the language you provided worked perfectly
so perfectly in fact that i was wondering if i might push my luck
my workbook contains two worksheets
worksheet 1 has 1600 rows of information
worksheet 2 has basically the same info but each row that contains that info
is now seperated by 15 lines thanx to you
is there a way to insert hyperlinks into column A of worksheet 1 that will
link each row to its corresponding row in worksheet 2?
any advice on this matter will be greatly appreciated and thank you for the
time youve already spent on me
brock

Hi BROCK:

[quoted text clipped - 55 lines]
thank you for your assistance
brock


--
--------------------
Simon - UK

Email at simon22mports [ a t ] hot mail [ d ot ]com

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200704/1

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 29
Default how do i write a macro that will add rows into a spreadsheet

yes simon,
thats exactly what im trying to do
brock

"smw226 via OfficeKB.com" wrote:

Hi Brock,

Just to confirm my uderstanding:

Do you want, for example, the first hyperlink in sheet!A1 to reference Sheet2!
A1, then Sheet!A2 to reference Sheet2!A16 etc ?

Thanks,

Simon



BROCK8292 wrote:
thank you for your help smw226
the language you provided worked perfectly
so perfectly in fact that i was wondering if i might push my luck
my workbook contains two worksheets
worksheet 1 has 1600 rows of information
worksheet 2 has basically the same info but each row that contains that info
is now seperated by 15 lines thanx to you
is there a way to insert hyperlinks into column A of worksheet 1 that will
link each row to its corresponding row in worksheet 2?
any advice on this matter will be greatly appreciated and thank you for the
time youve already spent on me
brock

Hi BROCK:

[quoted text clipped - 55 lines]
thank you for your assistance
brock


--
--------------------
Simon - UK

Email at simon22mports [ a t ] hot mail [ d ot ]com

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200704/1




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 29
Default how do i write a macro that will add rows into a spreadsheet

thank you again for the time and attention youre giving me
youre understanding is 100% accurate
that is exactly what im trying to do
brock

"smw226 via OfficeKB.com" wrote:

Hi Brock,

Just to confirm my uderstanding:

Do you want, for example, the first hyperlink in sheet!A1 to reference Sheet2!
A1, then Sheet!A2 to reference Sheet2!A16 etc ?

Thanks,

Simon



BROCK8292 wrote:
thank you for your help smw226
the language you provided worked perfectly
so perfectly in fact that i was wondering if i might push my luck
my workbook contains two worksheets
worksheet 1 has 1600 rows of information
worksheet 2 has basically the same info but each row that contains that info
is now seperated by 15 lines thanx to you
is there a way to insert hyperlinks into column A of worksheet 1 that will
link each row to its corresponding row in worksheet 2?
any advice on this matter will be greatly appreciated and thank you for the
time youve already spent on me
brock

Hi BROCK:

[quoted text clipped - 55 lines]
thank you for your assistance
brock


--
--------------------
Simon - UK

Email at simon22mports [ a t ] hot mail [ d ot ]com

Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200704/1


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
Trying to write vba code to import another spreadsheet... joep3 Excel Discussion (Misc queries) 3 September 6th 06 06:50 PM
Help write Macro nc Excel Discussion (Misc queries) 5 November 17th 05 03:19 PM
Write to a New Spreadsheet Daniell Excel Discussion (Misc queries) 3 October 5th 05 10:21 PM
is it possible to execute write to the fields in another .xsl form a macro in another .xsl? e.g. some way to load another .xsl into an .xsl macro and write to its data? Daniel Excel Worksheet Functions 1 June 23rd 05 11:38 PM
insert rows in excel spreadsheet via macro Floyd Elkins Excel Worksheet Functions 3 May 24th 05 05:51 PM


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