Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to delete certain results
I am making a macro that deletes #N/A's, but i want to add a few things to it
that should be deleted: the phrases "total board" and "total metal", and any non-text (i.e. any number) that appears. this is what i have so far: Public Sub DeleteStuff() Cells.SpecialCells(xlCellTypeFormulas, xlErrors).Delete End Sub what do i add to meet my specifications? thanks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to delete certain results
yr macro will delete ALL cells with errors and formulas that are in
the worksheet to remove "total board" and "total metal" and numeric values select yr data and use: Sub deletstuff2() For Each cell in Selection If cell = ""total board" or cell = "total metal" or IsNumeric(cell) Then cell.Delete End If Next cell |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to delete certain results
forgot about "End Sub" after "Next cell"
sorry |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to delete certain results
Thanks for the reply. Im sure this will help. for simplification purposes, i
want to add it to the already existing macro. this is what it looks like: Public Sub DeleteStuff() Cells.SpecialCells(xlCellTypeFormulas, xlErrors).Delete For Each cell In Selection If cell = ""total board" or cell = "total metal" or IsNumeric(cell) Then cell.Delete End If Next cell End Sub this gives me an error. what is wrong? thanks. "Jarek Kujawa" wrote: forgot about "End Sub" after "Next cell" sorry |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to delete certain results
probably you didn't select an area with "total board" etc.
besides "Then" must be in the same line as "If" (the browser wrapped it incorrectly) try this version Public Sub DeleteStuff() For Each cell In Selection If cell = ""total board" or cell = "total metal" or IsNumeric(cell) or cell.HasFormula or IsError(Cell) Then cell.Delete End If Next cell End Sub this macro will delete ONLY cells (fulfilling conditions) in the SELECTED AREA |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to delete certain results
the browser wrapped it incorrectly AGAIN
Public Sub DeleteStuff() For Each cell In Selection If cell = ""total board" or cell = "total metal" _ or IsNumeric(cell) or cell.HasFormula _ or IsError(Cell) Then cell.Delete End If Next cell End Sub this should work well |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to delete certain results
something isnt lining up with the paste. here is a picture of what happens, i
cant seem to get it aligned properly. here is my macro: http://img119.imageshack.us/img119/8384/macromb4.jpg also, the selection is the whole worksheet, so maybe that part of the code needs modified? im not sure, im not so good with this macro business. "Jarek Kujawa" wrote: probably you didn't select an area with "total board" etc. besides "Then" must be in the same line as "If" (the browser wrapped it incorrectly) try this version Public Sub DeleteStuff() For Each cell In Selection If cell = ""total board" or cell = "total metal" or IsNumeric(cell) or cell.HasFormula or IsError(Cell) Then cell.Delete End If Next cell End Sub this macro will delete ONLY cells (fulfilling conditions) in the SELECTED AREA |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to delete certain results
Ok thanks, but for some reason ITEM and zeros still appear. i changed the
code to this: 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 is that right? thanks. "Jarek Kujawa" wrote: the browser wrapped it incorrectly AGAIN Public Sub DeleteStuff() For Each cell In Selection If cell = ""total board" or cell = "total metal" _ or IsNumeric(cell) or cell.HasFormula _ or IsError(Cell) Then cell.Delete End If Next cell End Sub this should work well |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to delete certain results
should be
|
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to delete certain results
thanks. it still isnt working for some reason. i made a new topic towards the
top since this one is getting kind of cluttered. "Jarek Kujawa" wrote: should be |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I delete the formula but keep the results | Excel Worksheet Functions | |||
Macro to delete sheets and saves remaining file does not properly delete module | Excel Programming | |||
Delete results of Autofilter??? | Excel Programming | |||
Delete based on results of formula | Excel Programming | |||
How can I list the results of my macro without overwritng previous results? | Excel Programming |