Hi kosti,
Thanks for being my 2,000th posting!!
Try this (initially on a copy of your data as the results cannot be undone if they're not as expected):
Option Explicit
Sub Macro1()
Dim lngMyCol As Long, _
lngMyRow As Long
Dim xlnCalcMethod As XlCalculation
With Application
xlnCalcMethod = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With
lngMyCol = Cells.Find("*", SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column + 1
lngMyRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
With Columns(lngMyCol)
With Range(Cells(4, lngMyCol), Cells(lngMyRow, lngMyCol))
.Formula = "=IF(LEFT(CELL(""format"",D4),1)=""P"","""",NA())" 'http://www.ozgrid.com/forum/showthread.php?t=80506
ActiveSheet.Calculate
.Value = .Value
End With
On Error Resume Next 'Turn error reporting off - OK to ignore 'No cells found' message
.SpecialCells(xlCellTypeConstants, xlErrors).EntireRow.Delete
On Error GoTo 0 'Turn error reporting back on
.Delete
End With
With Application
.Calculation = xlnCalcMethod
.ScreenUpdating = True
End With
End Sub
Regards,
Robert
Bookmarks