LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Help writing a macro

Not absolutely sure about the row gaps, but let us assume that you want
every 8th row from row 11 to row 235 (you can always adjust to suit) then
something like

Sub AddRows()
Dim sh As Worksheet
Dim i As Long

For Each sh In Worksheets(Array("Jan","Feb","Mar")) ' add rest yourself
For i = 235 to 11 Step -8
rows(i).Resize(2).Insert
Next i
Next sh
End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"IcarusFB" wrote in
message ...

Hi all! I'm very new to macros (I just discovered them tonight! lol)
and I am having some problems:

I have 12 sheets (Jan-Dec) on the project I am working on and each page
has stats on 28 staff members in my department. I am trying to insert 2
rows for each staff member on each sheet. That works out to 672 rows
that I have to add, which is very time consuming. Here is the macro I
have so far:

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 31/12/2005 by John Smith
'
' Keyboard Shortcut: Ctrl+t
'
Range("B11:AJ11").Select
Selection.EntireRow.Insert
Selection.EntireRow.Insert

End Sub

For the range, the numbers would change as follows: B21:AJ21, B29:AJ29,
B37:AJ37, etc....

Is it possible to write all of this under one macro or do I have to
write a different macro for each row?

Thanks for your time!

(I have a feeling its going to be quicker to add the rows manually).


--
IcarusFB
------------------------------------------------------------------------
IcarusFB's Profile:

http://www.excelforum.com/member.php...o&userid=29905
View this thread: http://www.excelforum.com/showthread...hreadid=497120



 
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
Writing a macro RB[_2_] Excel Worksheet Functions 0 January 14th 08 05:40 PM
Writing a macro Roxio Excel Programming 1 October 26th 05 05:56 PM
Macro Writing rjamison Excel Programming 0 June 14th 05 12:14 AM
help in writing a macro slim[_2_] Excel Programming 1 February 13th 04 01:41 AM
Writing Macro Tammy Klein Excel Programming 1 October 3rd 03 09:13 PM


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