Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Selecting Undefined multplie rows

I am trying to write a macro to copy seven rows of data and insert them right
after the seventh row and then go to the next 7 rows of data (as long as
there is data in column A) and copy them and insert them right after the 7th
row and continue on as long as there is data in column A.
I figure a Loop would be the easiest, this is what I have but it is
inserting 1 blank row. Any help would be appreciated. thanks

Do Until ActiveCell.Value = ""
If ActiveCell.Value 0 Then
ActiveCell.EntireRow.Select
Application.CutCopyMode = False
Selection.Copy
ActiveCell.EntireRow.Offset(1, 0).Select
Selection.Insert Shift:=x1Down
ActiveCell.EntireRow.Offset(1, 0).Select
Else
End If
Loop
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Selecting Undefined multplie rows

I don't quite understand what you are trying. You want to copy to the column
until empty and you are copying to the same column??? Maybe you can give a
better example.

This macro will take cell 1-7 and copy to row 8

Sub copy7()
ac = ActiveCell.Column
lr = Cells(Rows.Count, ac).End(xlUp).Row + 1
For i = 8 To lr Step 7
Cells(1, ac).Resize(7,111).Copy Cells(lr, ac)
Next i
End Sub

This one will continue to the desired. This case 35
Sub copy7a()
ac = ActiveCell.Column
lr = Cells(Rows.Count, ac).End(xlUp).Row + 1
'For i = 8 To lr Step 7
For i = 8 To 35 Step 7
Cells(1, ac).Resize(7, 111).Copy Cells(lr, ac)
lr = lr + 7
Next i
End Sub


--
Don Guillett
SalesAid Software

"Curt D." wrote in message
...
I am trying to write a macro to copy seven rows of data and insert them
right
after the seventh row and then go to the next 7 rows of data (as long as
there is data in column A) and copy them and insert them right after the
7th
row and continue on as long as there is data in column A.
I figure a Loop would be the easiest, this is what I have but it is
inserting 1 blank row. Any help would be appreciated. thanks

Do Until ActiveCell.Value = ""
If ActiveCell.Value 0 Then
ActiveCell.EntireRow.Select
Application.CutCopyMode = False
Selection.Copy
ActiveCell.EntireRow.Offset(1, 0).Select
Selection.Insert Shift:=x1Down
ActiveCell.EntireRow.Offset(1, 0).Select
Else
End If
Loop



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
VBA Functions Undefined James O. Thompson Excel Worksheet Functions 2 January 20th 09 10:41 PM
after selecting 50 rows of a column i can't reference the cells in the rows Bob Salzer New Users to Excel 2 July 21st 06 10:29 PM
Undefined function q Excel Programming 4 February 25th 06 03:47 AM
Undefined function q Excel Programming 3 February 24th 06 09:22 PM
Removing Empty Rows and selecting Specific Rows Jetheat[_8_] Excel Programming 7 August 12th 05 12:10 AM


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