You are here:

Excel/Delete row etc in more than 1 sheet




You anwsered a question on removing row etc.  I require a similiar code.  I do not want all sheets to be checked, leave out say sheet1 and sheet3 and do the rest.
On that code above I get an error saying that named argument not found at part line   ......searchFormat:=.....
Also I would use athe contents of the active cell to find and not an entry in input box.
Your help appreciated.

Hi Charly,

You probably are using an older version of Excel, correct?

You could modify the code like so:

Sub RemoveRow()
   Dim oSh As Worksheet
   Dim oBk As Workbook
   Dim sFind As String
   Dim oFound As Range
   sFind = ActiveCell.Value
   If sFind <> "" Then
       On Error Resume Next
       For Each oSh In oBk.Worksheets
         If Not oSh.Name = "Sheet1" And Not oSh.Name = "Sheet3" Then
         Set oFound = Nothing
         Set oFound = oSh.UsedRange.Cells.Find(What:=sFind, LookAt:=xlWhole, SearchOrder :=xlByRows, MatchCase:=False)
         Loop Until oFound Is Nothing
         End If
   End If
End Sub  
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Jan Karel Pieterse


Excel and Excel/VBA questions


Excel MVP

Self employed Excel developer

Bachelor in Chemical Engineering

Awards and Honors
Microsoft MVP award since 2002

Past/Present Clients
Shell, Fortis bank, ABN-AMRO bank, Morgan Stanley, ...

©2016 All rights reserved.