Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Help! with Macro - delete entire row

Hi,
I am downloading data from AS/400 in text format on a daily basis and it is very pains taking to clean the headers as it is over 5000 lines.

Report xyz SUMMARY
2/22/06 PAGE
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Fc Cls No Type No UM UOM Cur Cost QTY
================================================== =====================================
TT GP 02684 B 10000 xx xxx xxxxxxxxxx x CA CA CAD 26.02000 1256.000
TT GP 02685 B 10000 xx xxx xxxxxxxxxx x CA CA CAD 23.78000 540.000

Can any one suggest a macro which can do the following

Search line by line for words like "Report", "Page", " =========" etc etc and del the entire row (i meam every thing in that row)
In the end sort the data by column "A"

Thanks,

Rashid
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default Help! with Macro - delete entire row

This works,

You will have to change the letter column letter to suit

Dim LastRow As Long
Dim RowNdx As Long
Dim OldVal As String

LastRow = Cells(Rows.Count, "A").End(xlUp).Row
For RowNdx = LastRow To 1 Step -1
If Left(Cells(RowNdx, "A"), 6) = "Report" Then
'The length of the word is 6 the word is report if you want to remove ====
you then need to change 6 to 4
Rows(RowNdx).Delete
End If
Next RowNdx

If you have any problems email me @



And I will assist further
HTH

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200603/1
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Help! with Macro - delete entire row

Assuming Cost is in Column 10, and the word Cost is in Row 3

Sub ClearBad()
Dim
v = Rows(3)
columns(10).Specialcells(xlbanks).EntireRow.Delete
Columns(10).Specialcells(xlconstants,xlTextValues) .EntireRow.Delete
Rows(1).Insert
Rows(1).Value = v
End Sub

may work. Adjust to fit

--
Regards,
Tom Ogilvy



"Rashid" wrote in message
.. .
Hi,
I am downloading data from AS/400 in text format on a daily basis and it is
very pains taking to clean the headers as it is over 5000 lines.

Report xyz SUMMARY
2/22/06 PAGE
---------------------------------------------------------------------------
----------------------------------------------------------------------------
---------------------
Fc Cls No Type No UM UOM
Cur Cost QTY

================================================== ==========================
===========
TT GP 02684 B 10000 xx xxx xxxxxxxxxx x CA CA
CAD 26.02000 1256.000
TT GP 02685 B 10000 xx xxx xxxxxxxxxx x CA CA
CAD 23.78000 540.000

Can any one suggest a macro which can do the following

Search line by line for words like "Report", "Page", " =========" etc etc
and del the entire row (i meam every thing in that row)
In the end sort the data by column "A"

Thanks,

Rashid


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
Macro to copy values then delete row for entire sheet Pyrotoy New Users to Excel 18 December 9th 08 12:43 AM
Macro - delete entire row which contain a specific text Dileep Chandran Excel Worksheet Functions 1 December 6th 06 01:08 PM
macro to delete entire rows when column A is blank ...a quick macro vikram Excel Programming 4 May 3rd 04 08:45 PM
macro to find date format in a cell and delete that entire row vikram Excel Programming 8 April 30th 04 06:00 PM
Delete Entire Row. Sam Excel Programming 5 December 21st 03 05:56 AM


All times are GMT +1. The time now is 10:04 PM.

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"