Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Need the code for a simple macro

I have looked on the internet and through a couple forums for code to
insert a new row in every other row of a spreadsheet, I work with a lot
of data and sometimes the people above me will delete out the empty rows
and it makes spacing off so i cannot copy and paste anything out of it
and it gets old pasting adjusting 6000 excel rows and such.......I just
need a macro that i can click on a cell and it will insert a row under
it and from there down in every other row until an end row that i
specify.....thanx

Durst

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Need the code for a simple macro

Why do you need the empty rows?

If just for appearance, your life may be easier if you just delete them and set
the row heights to double the height.

But................

Sub InsertALTrows()
'David McRitchie, misc 2001-06-30
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim I As Integer
For I = Selection(Selection.Count).Row To Selection(1).Row + 1 Step -1
Rows(I).EntireRow.Insert
Next I
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub

Select the rows you want then run the macro using a button or shortcut key
combo.


Gord Dibben MS Excel MVP

On Thu, 21 Jun 2007 14:15:31 -0700, VB MacroMan wrote:

I have looked on the internet and through a couple forums for code to
insert a new row in every other row of a spreadsheet, I work with a lot
of data and sometimes the people above me will delete out the empty rows
and it makes spacing off so i cannot copy and paste anything out of it
and it gets old pasting adjusting 6000 excel rows and such.......I just
need a macro that i can click on a cell and it will insert a row under
it and from there down in every other row until an end row that i
specify.....thanx

Durst

*** Sent via Developersdex http://www.developersdex.com ***


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Need the code for a simple macro

Worked amazingly thanx guys.............

Durst

*** Sent via Developersdex http://www.developersdex.com ***
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Need the code for a simple macro

If you really need it something like this should do it:


Sub InsertEmptyRows()
Dim r1 As Range
Dim r2 As Range
Dim i As Integer
Set r1 = Application.Selection
For i = r1.Rows.Count To 2 Step -1
Set r2 = r1.Rows(i).EntireRow
r2.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Next
End Sub

TZS

"VB MacroMan" schrieb im Newsbeitrag
...
I have looked on the internet and through a couple forums for code to
insert a new row in every other row of a spreadsheet, I work with a lot
of data and sometimes the people above me will delete out the empty rows
and it makes spacing off so i cannot copy and paste anything out of it
and it gets old pasting adjusting 6000 excel rows and such.......I just
need a macro that i can click on a cell and it will insert a row under
it and from there down in every other row until an end row that i
specify.....thanx

Durst

*** Sent via Developersdex http://www.developersdex.com ***



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
Need simple 'Paste' macro code [email protected] Excel Programming 1 April 14th 07 01:10 PM
Need a simple printing macro code cenee Excel Programming 1 June 22nd 06 03:20 AM
Could someone HELP TRANSLATE this simple psuedo code into MACRO pl bxc2739[_3_] Excel Programming 1 April 27th 06 07:46 PM
Could someone HELP TRANSLATE this simple psuedo code into MACRO please?! bxc2739 Excel Discussion (Misc queries) 3 April 27th 06 06:53 PM
Need code for Excel Simple Visual Basic Macro to select next avai. Marco Margaritelli[_3_] Excel Programming 6 November 2nd 04 10:26 PM


All times are GMT +1. The time now is 10:18 AM.

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"