PC Review


Reply
Thread Tools Rate Thread

Deleteing a worksheet

 
 
=?Utf-8?B?S2V2aW4gUG9ydGVy?=
Guest
Posts: n/a
 
      27th Aug 2007
I am looking at a particular cell (E5) and if the word Total is in there I
want it to delete the worksheet.

Not sure why the following code doesn't work. Seemd fairly straight forward.

If Sheets("Baton Rouge").Cell(5, 1) = "TOTAL" Then
Sheets("Baton Rouge").Delete
End If

Thanks,

Kevin Porter
 
Reply With Quote
 
 
 
 
=?Utf-8?B?S2V2aW4gUG9ydGVy?=
Guest
Posts: n/a
 
      27th Aug 2007
By the way it should read Cells not Cell. It does in the program.

"Kevin Porter" wrote:

> I am looking at a particular cell (E5) and if the word Total is in there I
> want it to delete the worksheet.
>
> Not sure why the following code doesn't work. Seemd fairly straight forward.
>
> If Sheets("Baton Rouge").Cell(5, 1) = "TOTAL" Then
> Sheets("Baton Rouge").Delete
> End If
>
> Thanks,
>
> Kevin Porter

 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      27th Aug 2007
> If Sheets("Baton Rouge").Cell(5, 1) = "TOTAL" Then

Cell must be Cells

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Kevin Porter" <(E-Mail Removed)> wrote in message news:BCCFFFA9-48B5-4153-9785-(E-Mail Removed)...
>I am looking at a particular cell (E5) and if the word Total is in there I
> want it to delete the worksheet.
>
> Not sure why the following code doesn't work. Seemd fairly straight forward.
>
> If Sheets("Baton Rouge").Cell(5, 1) = "TOTAL" Then
> Sheets("Baton Rouge").Delete
> End If
>
> Thanks,
>
> Kevin Porter

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      27th Aug 2007
VBA is case sensitive unless you've done something special like adding this to
the top of the module:

Option Compare Text


You could also use:
If lcase(Sheets("Baton Rouge").Cells(5, 1).value) = lcase("TOTAL") Then

Or you may want to look at strcomp() in VBA's help.





Kevin Porter wrote:
>
> By the way it should read Cells not Cell. It does in the program.
>
> "Kevin Porter" wrote:
>
> > I am looking at a particular cell (E5) and if the word Total is in there I
> > want it to delete the worksheet.
> >
> > Not sure why the following code doesn't work. Seemd fairly straight forward.
> >
> > If Sheets("Baton Rouge").Cell(5, 1) = "TOTAL" Then
> > Sheets("Baton Rouge").Delete
> > End If
> >
> > Thanks,
> >
> > Kevin Porter


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleteing Sian Windows Vista Mail 4 26th Aug 2009 08:30 PM
deleteing hershel Windows Vista Mail 1 5th Jun 2008 03:26 PM
Deleteing koba Microsoft Excel Misc 2 25th Nov 2005 04:11 AM
Deleteing Chris Microsoft Access Getting Started 1 23rd Jun 2005 06:17 PM
Re: Deleteing IE Frank Saunders, MS-MVP Windows XP Internet Explorer 0 23rd Aug 2003 10:02 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:53 PM.