View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Inserting "template" rows

Hi Jenny,

Try:

'=========================
Sub Tester02()

Dim sh1 As Worksheet, sh2 As Worksheet
Dim insRng As Range, RngDest As Range
Dim rCell As Range
Dim Lrow As Long, i As Long, j As Long


With ThisWorkbook
Set sh1 = .Sheets("Sheet1") '<<======= CHANGE
Set sh2 = .Sheets("Sheet2") '<<======= CHANGE
End With

Lrow = sh1.Cells(Rows.Count, "A").End(xlUp).Row

Set insRng = sh2.Rows("1:3")

For i = Lrow To 1 Step -1
If IsEmpty(Cells(i, 1)) Then
insRng.Copy
Cells(i, 1).Insert Shift:=xlDown
Rows(i + 3).Delete
End If
Next
End Sub
'<<=========================

Change "Sheet1" to the name of the payroll sheet; similarly change "Sheet2",
if necessary.

Test the procedure on a copy of your workbook to ensure that my
interpretaion accords with your needs.

---
Regards,
Norman



"shikamikamoomoo"
<shikamikamoomoo.1s6jql_1121378761.5161@excelfor um-nospam.com wrote in
message news:shikamikamoomoo.1s6jql_1121378761.5161@excelf orum-nospam.com...

Hi...I have a payroll sheet that I need to insert 3 rows of copied text
at each blank line. I'm sure there is a way to do this using VBA code
or something of that sort, but I do not know how to do it. Simply put I
need...

If the row is blank, insert rows 1:3 from sheet 2.....or even better if
I did not need to have "sheet two" and I could insert preset rows of
information.

If someone could please help me out or point me in the right direction
to find out how to do this I would really appreciate it. Thanks!

Jenny


--
shikamikamoomoo
------------------------------------------------------------------------
shikamikamoomoo's Profile:
http://www.excelforum.com/member.php...o&userid=21018
View this thread: http://www.excelforum.com/showthread...hreadid=387344