LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default delete entire row based on value

Hi there...below is the code currently contained in my workbook...i should
pre-empt with the fact that my VBA knowledge is basic at best - and i'm
using excel 2000...

My "history data" was actually a .txt document, that i converted to excel
using the delimited function...there's a lot of giberish and blank rows that
i want to DELETE...

i've determined the FIELD contents, for the ROWS that i wish to KEEP, and
would appreciate any assistance in establishing the code...

the FIELD contents for the ROWS i wish to KEEP are as follows:

- Column A contains "SEQ: T"
- Column A contains "TOTAL"
- Column B contains "SVC"
- Column C contains "EXCHANGE RATE:" note-the text EXCHANGE RATE: is
followed by a series of exchange rates that vary - but as long as it STARTS
with "EXCHANGE RATE:" keep the row

appreciate your assistance!
Sandi

----------------------------------------------------------------------------
-----

Sub FormatHistory()

' TURNS SCREEN UPDATING OFF
Application.ScreenUpdating = False

' STATUS BAR MESSAGE IS ACTIVATED
Application.StatusBar = "Formatting Report, Please Wait..."

' INSERTS FORMULA INTO COLUMN I TO SUBTRACT COLUMNS E,F,G, FROM H
("TOTAL")
' TO ROWS BEGINNING WITH "TOTAL"

' EXTENDS FORMULAS IN COLUMN I TO END OF ROW
Set SH = ThisWorkbook.Worksheets("simhistory")

' FINDS THE LAST ROW OF ACTUAL DATA
LR = SH.Range("A65536").End(xlUp).Row

' THIS CLEARS OUT ALL OF THE FORMULAES FROM COLUMN I
SH.Range("I2:I65536").ClearContents

' THIS ADDS THE FORMULAS TO COLUMN I
If LR 1 Then
'IF THERE IS AT LEAST 1 ROW OF DATA, THEN IT WILL PUT IN THESE
'FORMULAS IN ROW 2 (FORMULA TO CALCULATE REV. FOR $50+)
SH.Range("I2").Formula =
"=IF(A2=""TOTAL"",IF(H20,H2-E2-F2-G2,""""))"
If LR 2 Then
'IF THERE IS MORE THAN 1 ROW OF DATA, THEN IT WILL FILL DOWN THE
'FORMULA IN I2 ONTO ALL THE OTHER NEEDED ROWS
SH.Range("I2:I" & LR).FillDown
End If
End If

' FORMATS COLUMN I TO CURRENCY
Range("I:I").Select
Selection.NumberFormat = "#,##0.00"

Range("I1").Select
' STATUS BAR MESSAGE IS DEACTIVATED
Application.StatusBar = False

' TURNS SCREEN UPDATING ON
Application.ScreenUpdating = True

MsgBox "Report has been formatted!"

End Sub


 
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
Specify a row based on data from a cell to delete entire row..... Fadedmartinikiss Excel Discussion (Misc queries) 0 March 11th 09 08:39 PM
Delete an entire row One-Leg Excel Discussion (Misc queries) 13 November 11th 08 08:27 PM
Delete entire row if David T Excel Discussion (Misc queries) 2 December 6th 06 10:14 PM
Hide/Delete entire rows based in the content of one cell Clueless Excel Discussion (Misc queries) 2 October 3rd 05 02:40 PM
Delete entire row based on cell content PHIL Excel Programming 2 December 3rd 03 01:39 AM


All times are GMT +1. The time now is 06:53 AM.

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"