Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Find and Replace Question

I'm using Visual Studio 2005 rather than VBA to write this program. I needed
to find and replace all "#N/A" with "". If there are no "#N/A" s in the
worksheet I get a message box from excel saying there was no data to
replace... what code would i need to close this message box without having to
do it manually? Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default Find and Replace Question

I don't use Visual Studio, but in VBA you could eliminate the messagebox:

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

Or did you wnat to see the messagebox for a few seconds and then have it
disappear automatically?

- David

NewToVB wrote:
I'm using Visual Studio 2005 rather than VBA to write this program. I needed
to find and replace all "#N/A" with "". If there are no "#N/A" s in the
worksheet I get a message box from excel saying there was no data to
replace... what code would i need to close this message box without having to
do it manually? Thanks!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Find and Replace Question

Well this is what I have in VS:

On Error Resume Next
oApp.Range("A1:X16").Replace("#N/A", "", XlLookAt.xlPart,
XlSearchOrder.xlByRows, MatchCase:=False, SearchFormat:=False,
ReplaceFormat:=False)

oAppBk11.Save()
oAppBk11.Close()

oApp is the excel object and oAppBk11 is the workbook name.... it still
gives me the message box, any ideas?

"David Hilberg" wrote:

I don't use Visual Studio, but in VBA you could eliminate the messagebox:

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

Or did you wnat to see the messagebox for a few seconds and then have it
disappear automatically?

- David

NewToVB wrote:
I'm using Visual Studio 2005 rather than VBA to write this program. I needed
to find and replace all "#N/A" with "". If there are no "#N/A" s in the
worksheet I get a message box from excel saying there was no data to
replace... what code would i need to close this message box without having to
do it manually? Thanks!


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
find a replace character question jimmc Excel Discussion (Misc queries) 3 January 19th 07 10:47 PM
Advanced Find and Replace Question Ryan Excel Discussion (Misc queries) 3 August 6th 06 06:56 PM
Find & replace question.....I believe anorton Excel Discussion (Misc queries) 13 June 4th 06 01:25 PM
Find & Replace question Stuart[_21_] Excel Programming 11 March 28th 05 07:26 PM
Find/Replace Question Littlebear Excel Discussion (Misc queries) 3 February 8th 05 03:44 PM


All times are GMT +1. The time now is 05:36 PM.

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"