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! |
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! |
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! |
All times are GMT +1. The time now is 07:48 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com