Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I wish to write vba code that finds occurrences of #N/A, #NAME, etc in Excel
spreadsheets. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Record a macro when you select a range (or all the cells)
edit|goto|Special Errors You'll be able to record a macro when you search for constants with errors and formulas with errors. So you'll end up with two macros. viking4020 wrote: I wish to write vba code that finds occurrences of #N/A, #NAME, etc in Excel spreadsheets. -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Use these lines in a loop stepping through the cells to be checked:
If WorksheetFunction.IsError(ActiveCell) Then ' your code End If Regards, Stefi €˛viking4020€¯ ezt Ć*rta: I wish to write vba code that finds occurrences of #N/A, #NAME, etc in Excel spreadsheets. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Wed, 25 Jun 2008 04:57:01 -0700, viking4020
wrote: I wish to write vba code that finds occurrences of #N/A, #NAME, etc in Excel spreadsheets. Not very specific requirements, but the following should get you started: Option Explicit Sub foo() Dim rStart As Range, rEnd As Range, c As Range Set rStart = [A1] Set rEnd = rStart.SpecialCells(xlCellTypeLastCell) For Each c In Range(rStart, rEnd) If IsError(c) Then Debug.Print c.Address, c.Text End If Next c End Sub --ron |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Wed, 25 Jun 2008 08:41:08 -0400, Ron Rosenfeld
wrote: On Wed, 25 Jun 2008 04:57:01 -0700, viking4020 wrote: I wish to write vba code that finds occurrences of #N/A, #NAME, etc in Excel spreadsheets. Not very specific requirements, but the following should get you started: Option Explicit Sub foo() Dim rStart As Range, rEnd As Range, c As Range Set rStart = [A1] Set rEnd = rStart.SpecialCells(xlCellTypeLastCell) For Each c In Range(rStart, rEnd) If IsError(c) Then Debug.Print c.Address, c.Text End If Next c End Sub --ron Gary's student reminded me that UsedRange was the property I really wanted: ====================== Option Explicit Sub foo() Dim c As Range For Each c In ActiveSheet.UsedRange If IsError(c) Then Debug.Print c.Address, c.Text End If Next c End Sub ==================== --ron |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This will find and Select all occurances of #N/A:
Sub findena() Set ena = Nothing For Each r In ActiveSheet.UsedRange If r.Text = "#N/A" Then If ena Is Nothing Then Set ena = r Else Set ena = Union(ena, r) End If End If Next ena.Select End Sub -- Gary''s Student - gsnu200793 "viking4020" wrote: I wish to write vba code that finds occurrences of #N/A, #NAME, etc in Excel spreadsheets. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
search for text "beginning with" "containing" wildcards | Excel Worksheet Functions | |||
=IF(ISNUMBER(SEARCH("ELB",B2)),"Pipe") add more like "ELB" "FLG" | Excel Worksheet Functions | |||
How do I change the Excel "search" default to WORKBOOK & DATA? | Excel Discussion (Misc queries) | |||
=IF(ISERROR(SEARCH("insurance",A125,1)),"","*") | Excel Worksheet Functions | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) |