Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default looking through entire sheet

I need to look at every cell in the sheet and if it has "#N/A" then I need to
replace it with "" . I know of a long way to do it (looping through each
cell in each column), but I wanted to see if anyone new of a shorter way to
just look through the whole sheet. So far I have this... and I would do this
for each column. I'm using Visual Studio rather than VBA but its similar.
Thanks!

For i = 1 To lastRow

If oApp.Range("B1:B" & lastRow).Value = "#N/A" Then
oApp.Range("B" & i).Value = ""
End If
Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default looking through entire sheet

Since Excel has Goto/Special/Formulas/Errors, you could record a macro
to get you that far, then test each cell in the selection for "#N/A".

- David

NewToVB wrote:
I need to look at every cell in the sheet and if it has "#N/A" then I need to
replace it with "" .

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default looking through entire sheet

Here's some tested VBA code that may work for you:

On Error Resume Next
ActiveSheet.Cells.SpecialCells(xlCellTypeFormulas, 16).Select
For Each c In Selection
If c.Text = "#N/A" Then c.Value = ""
Next c

- David

David Hilberg wrote:
Since Excel has Goto/Special/Formulas/Errors, you could record a macro
to get you that far, then test each cell in the selection for "#N/A".

- David

NewToVB wrote:
I need to look at every cell in the sheet and if it has "#N/A" then I
need to replace it with "" .

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Autofit for entire sheet? Sonnich Excel Programming 1 February 21st 07 05:55 PM
Copy Entire Sheet Linda Excel Discussion (Misc queries) 1 June 11th 06 11:04 PM
Moving An Entire Row From One Sheet To Another M.A.Tyler Excel Discussion (Misc queries) 9 May 2nd 06 12:56 PM
Copy the entire sheet to overlay existing sheet? LurfysMa New Users to Excel 2 August 29th 05 07:05 PM
Subtract entire sheet? jennifer Excel Worksheet Functions 3 April 28th 05 03:43 AM


All times are GMT +1. The time now is 04:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"