Solved

if it can't be found end sub

Posted on 2014-03-19
2
202 Views
Last Modified: 2014-03-19
I am using the below code to find text. What I need is to say if the word[s] cannot be found End Sub. Can an expert provide me with the additional code that will do this please.

Rows("1:" & Cells.Find("Open and Closed").Row - 1).Delete

Thanks
0
Comment
Question by:Jagwarman
2 Comments
 
LVL 81

Accepted Solution

by:
zorvek (Kevin Jones) earned 500 total points
ID: 39939004
Dim FoundCell As Range
Set FoundCell = Cells.Find("Open and Closed")
If FoundCell Is Nothing Then Exit Sub
Rows("1:" & FoundCell.Row - 1).Delete

Kevin
0
 

Author Closing Comment

by:Jagwarman
ID: 39939009
Thanks Kevin exactly what I wanted.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question