View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
DFrank DFrank is offline
external usenet poster
 
Posts: 28
Default Jarek, almost there...

appreciate the response, but i dont know what happened when iran it. dunno if
it was an error in your code or the other guys, but it turned the values i
wanted to remain into #N/A's and completely reformatted my spreadsheet.

this is what im going back to for now:

Public Sub DeleteandSortStuff()


Sheets("MidStep").Select 'selects the worksheet "midStep" incase
macro ran
'from another worksheet.

Cells.SpecialCells(xlCellTypeFormulas, xlErrors).Delete 'Deletes
error cells


'needs to be code here to delete all terms 'Total Board',
''Total Metal', 'ITEM' and Zeros.

Range("D1:F1686").Select
Selection.Sort Key1:=Range("D1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal 'selects the range of remaining
values and
'sorts them, prepares for
transition to other
'worksheet.
End Sub
"StumpedAgain" wrote:

You can try the following:

Range("A1").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select

This will select everything in your current sheet and then you can run what
you have already for the current selection.

Hope this helps!

-SA

"DFrank" wrote:

thanks for your help so far, but im still hanging up at a certain point. i
want this to happen to the whole worksheet, not just a selection, so that may
be part of the problem.

For Each Cell In Selection
If Cell = "total board" Or Cell = "total metal" Or Cell = "ITEM" Or Cell
= "0" _
Or IsNumeric(Cell) Or Cell.HasFormula _
Or IsError(Cell) Then
Cell.Delete
End If
Next Cell

thats the code im trying to use, and theres something wrong with it
somewhere. everything still shows up, even with the code you gave me that
only had "total board" and "total metal" removed. please let me know if you
can be of anymore help. thanks.