Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Specify a row based on data from a cell to delete entire row..... | Excel Discussion (Misc queries) | |||
Delete an entire row | Excel Discussion (Misc queries) | |||
Delete entire row if | Excel Discussion (Misc queries) | |||
Hide/Delete entire rows based in the content of one cell | Excel Discussion (Misc queries) | |||
Delete entire row based on cell content | Excel Programming |