Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.charting
|
|||
|
|||
![]()
Trying to write a macro that will do a 'search and delete' type function for
cells that yield a "DIV/0" error. What I want to accomplish is a break in the line graph when there is no data. Problem is that excel 2003 treats anything in a cell other than a numerical value as a ZERO. Even if I write an IF(ISERROR) function to yield "", it still treats the cell as a zero value. The only way to get a break in the line is to actually delete out the formula completely when there's a "DIV/0" error. Any suggestions? |
#2
![]()
Posted to microsoft.public.excel.charting
|
|||
|
|||
![]()
Hi,
If your formula are in the range C4:C10 then, Sub ClearFormulaErrors() On error resume next range("C4:C10").SpecialCells(xlCellTypeFormulas,xl Errors).Clear End Sub Instead of "" use NA(). This will not create a gap but will stop if being treated as zero. Cheers Andy -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info "Tim H" wrote in message ... Trying to write a macro that will do a 'search and delete' type function for cells that yield a "DIV/0" error. What I want to accomplish is a break in the line graph when there is no data. Problem is that excel 2003 treats anything in a cell other than a numerical value as a ZERO. Even if I write an IF(ISERROR) function to yield "", it still treats the cell as a zero value. The only way to get a break in the line is to actually delete out the formula completely when there's a "DIV/0" error. Any suggestions? |
#3
![]()
Posted to microsoft.public.excel.charting
|
|||
|
|||
![]()
The NA() is perfect!!!
Thanks. "Andy Pope" wrote: Hi, If your formula are in the range C4:C10 then, Sub ClearFormulaErrors() On error resume next range("C4:C10").SpecialCells(xlCellTypeFormulas,xl Errors).Clear End Sub Instead of "" use NA(). This will not create a gap but will stop if being treated as zero. Cheers Andy -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info "Tim H" wrote in message ... Trying to write a macro that will do a 'search and delete' type function for cells that yield a "DIV/0" error. What I want to accomplish is a break in the line graph when there is no data. Problem is that excel 2003 treats anything in a cell other than a numerical value as a ZERO. Even if I write an IF(ISERROR) function to yield "", it still treats the cell as a zero value. The only way to get a break in the line is to actually delete out the formula completely when there's a "DIV/0" error. Any suggestions? |
#4
![]()
Posted to microsoft.public.excel.charting
|
|||
|
|||
![]()
Andy,
The NA() only works when there is data missing at the end of the chart range. If there's an NA() in the middle of the range, excel charts basically continue the last point of data out until there is new data instead of putting in breaks in the line. So, given your code below to actually clear the error formula cells, how do I adjust the code to start at a given point and read until there is no more data. In other words, every time I run the report, the range will change. Range may be C4:C10 this week, but can be C4:C15 next week. How do I alter the code below to read for data starting from C4 until the end of available data? Thanks, "Andy Pope" wrote: Hi, If your formula are in the range C4:C10 then, Sub ClearFormulaErrors() On error resume next range("C4:C10").SpecialCells(xlCellTypeFormulas,xl Errors).Clear End Sub Instead of "" use NA(). This will not create a gap but will stop if being treated as zero. Cheers Andy -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info "Tim H" wrote in message ... Trying to write a macro that will do a 'search and delete' type function for cells that yield a "DIV/0" error. What I want to accomplish is a break in the line graph when there is no data. Problem is that excel 2003 treats anything in a cell other than a numerical value as a ZERO. Even if I write an IF(ISERROR) function to yield "", it still treats the cell as a zero value. The only way to get a break in the line is to actually delete out the formula completely when there's a "DIV/0" error. Any suggestions? |
#5
![]()
Posted to microsoft.public.excel.charting
|
|||
|
|||
![]()
Try this variation.
Sub ClearFormulaErrors() On Error Resume Next Range(Cells(4, 3), Cells(Rows.Count, 3).End(xlUp) _ ).SpecialCells(xlCellTypeFormulas, xlErrors).Clear End Sub Generates a range for C4 to last value in column C Cheers Andy Tim H wrote: Andy, The NA() only works when there is data missing at the end of the chart range. If there's an NA() in the middle of the range, excel charts basically continue the last point of data out until there is new data instead of putting in breaks in the line. So, given your code below to actually clear the error formula cells, how do I adjust the code to start at a given point and read until there is no more data. In other words, every time I run the report, the range will change. Range may be C4:C10 this week, but can be C4:C15 next week. How do I alter the code below to read for data starting from C4 until the end of available data? Thanks, "Andy Pope" wrote: Hi, If your formula are in the range C4:C10 then, Sub ClearFormulaErrors() On error resume next range("C4:C10").SpecialCells(xlCellTypeFormulas,xl Errors).Clear End Sub Instead of "" use NA(). This will not create a gap but will stop if being treated as zero. Cheers Andy -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info "Tim H" wrote in message ... Trying to write a macro that will do a 'search and delete' type function for cells that yield a "DIV/0" error. What I want to accomplish is a break in the line graph when there is no data. Problem is that excel 2003 treats anything in a cell other than a numerical value as a ZERO. Even if I write an IF(ISERROR) function to yield "", it still treats the cell as a zero value. The only way to get a break in the line is to actually delete out the formula completely when there's a "DIV/0" error. Any suggestions? -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel "Move or Copy" and "Delete" sheet functions | Excel Worksheet Functions | |||
change "true" and "false" to "availble" and "out of stock" | Excel Worksheet Functions | |||
Macro to Replace/Delete Text Using "Watchword" List? | Excel Discussion (Misc queries) | |||
Any way to use toolbar button to delete cells and move cells "up"? | Excel Discussion (Misc queries) | |||
Macro to concatenate into "B1" B2 thru B"x" based on new data in "Col A" | Excel Discussion (Misc queries) |