#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 49
Default Cleaning forms

I have an imported text file from a lab system that has a header every 51 rows.

I would like to create a macro that deletes 6 rows every 51 rows, but can't
figure it out, please help. Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 43
Default Cleaning forms

You mean there are 6 heading rows in every 51 rows? Are the heading rows
the same distance apart throughout the file? Is there anything unique about
the heading rows (such as text in a column that normally has numbers)?

"Lost in Microbiology" wrote
in message ...
I have an imported text file from a lab system that has a header every 51
rows.

I would like to create a macro that deletes 6 rows every 51 rows, but
can't
figure it out, please help. Thanks.



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 49
Default Cleaning forms

Zone,

Correct, every at row 52 there are 6 consecutive rows that need to be
deleted. They have a title, the first column always starts out "REPORT
TYPE...."
The heading rows are the same distance throughout.

Thanks for your help


"Zone" wrote:

You mean there are 6 heading rows in every 51 rows? Are the heading rows
the same distance apart throughout the file? Is there anything unique about
the heading rows (such as text in a column that normally has numbers)?

"Lost in Microbiology" wrote
in message ...
I have an imported text file from a lab system that has a header every 51
rows.

I would like to create a macro that deletes 6 rows every 51 rows, but
can't
figure it out, please help. Thanks.




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Cleaning forms

If "Report Type" doesn't appear in any other cell except that header, then you
could use:

Option Explicit
Sub testme()

Dim myStr As String
Dim FoundCell As Range
Dim wks As Worksheet

Set wks = ActiveSheet

'* means there could be text following
'report type
myStr = "report type*"

With wks.Range("a:A")
Do
Set FoundCell = .Cells.Find(what:=myStr, _
after:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
lookat:=xlWhole, _
searchorder:=xlByRows, _
searchdirection:=xlNext, _
MatchCase:=False)

If FoundCell Is Nothing Then
'no more to fix
Exit Do
Else
FoundCell.Resize(6, 1).EntireRow.Delete
End If
Loop
End With
End Sub

Lost in Microbiology wrote:

Zone,

Correct, every at row 52 there are 6 consecutive rows that need to be
deleted. They have a title, the first column always starts out "REPORT
TYPE...."
The heading rows are the same distance throughout.

Thanks for your help

"Zone" wrote:

You mean there are 6 heading rows in every 51 rows? Are the heading rows
the same distance apart throughout the file? Is there anything unique about
the heading rows (such as text in a column that normally has numbers)?

"Lost in Microbiology" wrote
in message ...
I have an imported text file from a lab system that has a header every 51
rows.

I would like to create a macro that deletes 6 rows every 51 rows, but
can't
figure it out, please help. Thanks.





--

Dave Peterson
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
Cleaning data Torero Excel Worksheet Functions 3 November 28th 06 10:16 PM
Cleaning Data AMMark Excel Discussion (Misc queries) 1 October 19th 06 07:21 PM
Cleaning Up Data [email protected] Excel Discussion (Misc queries) 3 September 20th 06 04:40 PM
Spreadsheet cleaning Richard Excel Discussion (Misc queries) 3 December 13th 05 03:06 PM
ideas for Bid Forms for Office and Business Cleaning? happycamper46382 Excel Discussion (Misc queries) 0 October 10th 05 10:39 PM


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