View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] paul.robinson@it-tallaght.ie is offline
external usenet poster
 
Posts: 789
Default Macro formatting

Hi
This will copy the first seven rows in columns A and B down through the
column

Sub Macro1()
Dim myRange As Range
Dim myRangeRowCount As Long
Dim i As Long

Application.ScreenUpdating = False

Set myRange = Range("A1").CurrentRegion
myRangeRowCount = myRange.Rows.Count 'a multiple of 7
Range("A1:B7").Copy
For i = 1 To myRangeRowCount \ 7 - 1
Range("A1").Offset(7 * i, 0).PasteSpecial Paste:=xlPasteFormats, _
Operation:=xlNone, SkipBlanks:=False,
Transpose:=False
Next i
End Sub

Your data is assumed to start in A1. Change the "A1:B7" to your data
range in the first 7 rows.
regards
Paul

Sam Commar wrote:

Could someone please help with a macro or any other suggestion to format an
Excel sheet. Basically data is downloaded from a bank every week and the
size of the file can vary but the formatting is constant. That is each
record is 7 lines. So first record is line1-7, second record is line 8-14,
third record is line 15-21 and so on.

I need to format this data and basically I can record a macro for one data
set that is for the record on line 1 to 7. My question is how can I set it
to replicate so that it replicates for line 8-14 and then 15-21 and so on.
The source formatting remains the same except that the total length of the
file( no of records) changes every week.


Thanks very much for your help.

Regards

Sam