ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   to adjust download (https://www.excelbanter.com/excel-discussion-misc-queries/226924-adjust-download.html)

officegirl

to adjust download
 
I am downloading huge reports from unix and after the original 7 lines of
heading I need to delete the repeating page headings (always 7 lines)the data
is 49 lines
so I need the first 7 lines of heading than 49 lines of data, than delete 7
lines of heading , than I need 49 lines of data and this should repeat until
the end of the worksheet that is sometimes ~30000 lines

Per Jessen

to adjust download
 
Hi

This macro should to it:

Sub RemoveHeadings()

LastRow = Range("A" & Rows.Count).End(xlUp).Row
HeaderBlock = 7
DataBlock = 49
TargetRow = HeaderBlock + DataBlock

Rows(TargetRow + 1).Resize(7).Delete

Do
TargetRow = TargetRow + DataBlock
Rows(TargetRow + 1).Resize(7).Delete
LastRow = LastRow - 7
Loop Until TargetRow LastRow
End Sub

Regards,
Per

"officegirl" skrev i meddelelsen
...
I am downloading huge reports from unix and after the original 7 lines of
heading I need to delete the repeating page headings (always 7 lines)the
data
is 49 lines
so I need the first 7 lines of heading than 49 lines of data, than delete
7
lines of heading , than I need 49 lines of data and this should repeat
until
the end of the worksheet that is sometimes ~30000 lines




All times are GMT +1. The time now is 01:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com